Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
230e71cc
Commit
230e71cc
authored
Sep 17, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 17, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leaks in the table code.
parent
dcb0f239
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
msipriv.h
dlls/msi/msipriv.h
+0
-1
table.c
dlls/msi/table.c
+27
-6
No files found.
dlls/msi/msipriv.h
View file @
230e71cc
...
@@ -272,7 +272,6 @@ extern MSIHANDLE msiobj_findhandle( MSIOBJECTHDR *hdr );
...
@@ -272,7 +272,6 @@ extern MSIHANDLE msiobj_findhandle( MSIOBJECTHDR *hdr );
/* add this table to the list of cached tables in the database */
/* add this table to the list of cached tables in the database */
extern
void
add_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
);
extern
void
add_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
);
extern
void
remove_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
);
extern
void
remove_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
);
extern
void
free_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
);
extern
void
free_cached_tables
(
MSIDATABASE
*
db
);
extern
void
free_cached_tables
(
MSIDATABASE
*
db
);
extern
UINT
find_cached_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table
);
extern
UINT
find_cached_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table
);
extern
UINT
get_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table
);
extern
UINT
get_table
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
table
);
...
...
dlls/msi/table.c
View file @
230e71cc
...
@@ -396,6 +396,15 @@ end:
...
@@ -396,6 +396,15 @@ end:
return
ret
;
return
ret
;
}
}
static
void
free_table
(
MSITABLE
*
table
)
{
int
i
;
for
(
i
=
0
;
i
<
table
->
row_count
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
table
->
data
[
i
]
);
HeapFree
(
GetProcessHeap
(),
0
,
table
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
table
);
}
static
UINT
read_table_from_storage
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
ptable
)
static
UINT
read_table_from_storage
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
ptable
)
{
{
MSITABLE
*
t
;
MSITABLE
*
t
;
...
@@ -443,7 +452,10 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
...
@@ -443,7 +452,10 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
t
->
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
t
->
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
t
->
row_count
*
sizeof
(
USHORT
*
)
);
t
->
row_count
*
sizeof
(
USHORT
*
)
);
if
(
!
t
->
data
)
if
(
!
t
->
data
)
return
ERROR_NOT_ENOUGH_MEMORY
;
/* FIXME: memory leak */
{
r
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
err
;
}
/* transpose all the data */
/* transpose all the data */
TRACE
(
"Transposing data from %d columns
\n
"
,
t
->
row_count
);
TRACE
(
"Transposing data from %d columns
\n
"
,
t
->
row_count
);
...
@@ -451,7 +463,10 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
...
@@ -451,7 +463,10 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
{
{
t
->
data
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
row_size
);
t
->
data
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
row_size
);
if
(
!
t
->
data
[
i
]
)
if
(
!
t
->
data
[
i
]
)
return
ERROR_NOT_ENOUGH_MEMORY
;
/* FIXME: memory leak */
{
r
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
err
;
}
for
(
j
=
0
;
j
<
num_cols
;
j
++
)
for
(
j
=
0
;
j
<
num_cols
;
j
++
)
{
{
UINT
ofs
=
cols
[
j
].
offset
/
2
;
UINT
ofs
=
cols
[
j
].
offset
/
2
;
...
@@ -468,7 +483,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
...
@@ -468,7 +483,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
break
;
break
;
default:
default:
ERR
(
"oops - unknown column width %d
\n
"
,
n
);
ERR
(
"oops - unknown column width %d
\n
"
,
n
);
return
ERROR_FUNCTION_FAILED
;
r
=
ERROR_FUNCTION_FAILED
;
goto
err
;
}
}
}
}
}
}
...
@@ -477,6 +493,12 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
...
@@ -477,6 +493,12 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
err:
HeapFree
(
GetProcessHeap
(),
0
,
cols
);
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
free_table
(
t
);
return
r
;
}
}
/* add this table to the list of cached tables in the database */
/* add this table to the list of cached tables in the database */
...
@@ -499,9 +521,8 @@ static void release_table( MSIDATABASE *db, MSITABLE *table )
...
@@ -499,9 +521,8 @@ static void release_table( MSIDATABASE *db, MSITABLE *table )
if
(
!
table
->
ref_count
)
if
(
!
table
->
ref_count
)
{
{
remove_table
(
db
,
table
);
remove_table
(
db
,
table
);
HeapFree
(
GetProcessHeap
(),
0
,
table
->
data
);
TRACE
(
"Destroying table %s
\n
"
,
debugstr_w
(
table
->
name
));
HeapFree
(
GetProcessHeap
(),
0
,
table
);
free_table
(
table
);
TRACE
(
"Destroyed table %s
\n
"
,
debugstr_w
(
table
->
name
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment