https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eab017d18f265882c3a30…
commit eab017d18f265882c3a30f3352107945e734d5b6
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Mar 13 00:04:00 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:28:03 2022 +0100
[WINESYNC] msi: Fix a couple of memory leaks (Valgrind).
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 1cb43677632ded6aba8ba0b91937ded934c0c690 by Hans Leidekker
<hans(a)codeweavers.com>
---
dll/win32/msi/install.c | 7 ++++---
dll/win32/msi/package.c | 4 ++++
dll/win32/msi/streams.c | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 0afb6b29928..ebed6d4b64a 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -411,8 +411,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR
*name, MSIFOL
UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz)
{
MSIPACKAGE *package;
- const WCHAR *path;
- WCHAR *folderW;
+ WCHAR *path, *folderW;
UINT r;
TRACE("%s %p %p\n", debugstr_a(folder), buf, sz);
@@ -459,6 +458,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder,
char *buf, DW
else
r = ERROR_DIRECTORY;
+ heap_free(path);
heap_free(folderW);
msiobj_release(&package->hdr);
return r;
@@ -470,7 +470,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder,
char *buf, DW
UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD
*sz)
{
MSIPACKAGE *package;
- const WCHAR *path;
+ WCHAR *path;
UINT r;
TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
@@ -510,6 +510,7 @@ UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder,
WCHAR *buf,
else
r = ERROR_DIRECTORY;
+ heap_free(path);
msiobj_release(&package->hdr);
return r;
}
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index 2b3b3ad4e18..80cae055b22 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2132,6 +2132,7 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE
eMessageType,
ret = MSI_ProcessMessage( package, eMessageType, record );
+ msiobj_release( &record->hdr );
msiobj_release( &package->hdr );
return ret;
}
@@ -2696,7 +2697,10 @@ UINT __cdecl s_remote_FormatRecord(MSIHANDLE hinst, struct
wire_record *remote_r
{
*value = midl_user_allocate(++size * sizeof(WCHAR));
if (!*value)
+ {
+ MsiCloseHandle(rec);
return ERROR_OUTOFMEMORY;
+ }
r = MsiFormatRecordW(hinst, rec, *value, &size);
}
diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c
index e170c0367fc..e3a8c7bc30b 100644
--- a/dll/win32/msi/streams.c
+++ b/dll/win32/msi/streams.c
@@ -141,9 +141,9 @@ static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row,
MSIRECORD *rec, U
old = sv->db->streams[row].stream;
hr = IStream_QueryInterface( new, &IID_IStream, (void
**)&sv->db->streams[row].stream );
+ IStream_Release( new );
if (FAILED( hr ))
{
- IStream_Release( new );
return ERROR_FUNCTION_FAILED;
}
if (old) IStream_Release( old );