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
3e231d0f
Commit
3e231d0f
authored
Dec 11, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Fix memory leak on realloc failure in create_diff_row_query (cppcheck).
parent
a8e2aa6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
database.c
dlls/msi/database.c
+4
-7
No files found.
dlls/msi/database.c
View file @
3e231d0f
...
...
@@ -1412,7 +1412,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec)
static
LPWSTR
create_diff_row_query
(
MSIDATABASE
*
merge
,
MSIQUERY
*
view
,
LPWSTR
table
,
MSIRECORD
*
rec
)
{
LPWSTR
query
=
NULL
,
clause
=
NULL
,
val
;
WCHAR
*
query
=
NULL
,
*
clause
=
NULL
,
*
new_clause
,
*
val
;
LPCWSTR
setptr
,
key
;
DWORD
size
,
oldsize
;
MSIRECORD
*
keys
;
...
...
@@ -1422,10 +1422,6 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view,
if
(
r
!=
ERROR_SUCCESS
)
return
NULL
;
clause
=
calloc
(
1
,
sizeof
(
WCHAR
));
if
(
!
clause
)
goto
done
;
size
=
1
;
count
=
MSI_RecordGetFieldCount
(
keys
);
for
(
i
=
1
;
i
<=
count
;
i
++
)
...
...
@@ -1440,12 +1436,13 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view,
oldsize
=
size
;
size
+=
lstrlenW
(
setptr
)
+
lstrlenW
(
key
)
+
lstrlenW
(
val
)
-
4
;
clause
=
realloc
(
clause
,
size
*
sizeof
(
WCHAR
));
if
(
!
clause
)
new_
clause
=
realloc
(
clause
,
size
*
sizeof
(
WCHAR
));
if
(
!
new_
clause
)
{
free
(
val
);
goto
done
;
}
clause
=
new_clause
;
swprintf
(
clause
+
oldsize
-
1
,
size
-
(
oldsize
-
1
),
setptr
,
key
,
val
);
free
(
val
);
...
...
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