Hans Leidekker : msi: Fix memory leaks.
Alexandre Julliard
julliard at winehq.org
Fri Oct 12 18:00:41 CDT 2018
Module: wine
Branch: master
Commit: 965ca1b4de78600366cde437c97a7208a954b18b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=965ca1b4de78600366cde437c97a7208a954b18b
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Oct 12 16:44:02 2018 +0200
msi: Fix memory leaks.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msi/custom.c | 49 ++++++++++++++++++++++++++-----------------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 97bde52..3cb0f31 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -538,46 +538,49 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
if (r != ERROR_SUCCESS)
return r;
+ hPackage = alloc_msi_remote_handle( remote_package );
+ if (!hPackage)
+ {
+ ERR( "failed to create handle for %x\n", remote_package );
+ midl_user_free( dll );
+ midl_user_free( proc );
+ return ERROR_INSTALL_FAILURE;
+ }
+
hModule = LoadLibraryW( dll );
if (!hModule)
{
ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() );
+ midl_user_free( dll );
+ midl_user_free( proc );
+ MsiCloseHandle( hPackage );
return ERROR_SUCCESS;
}
fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc );
- if (fn)
+ if (!fn) WARN( "GetProcAddress(%s) failed\n", debugstr_a(proc) );
+ else
{
- hPackage = alloc_msi_remote_handle( remote_package );
- if (hPackage)
+ handle_msi_break(proc);
+
+ __TRY
{
- TRACE("calling %s\n", debugstr_a(proc));
- handle_msi_break(proc);
-
- __TRY
- {
- r = custom_proc_wrapper(fn, hPackage);
- }
- __EXCEPT_PAGE_FAULT
- {
- ERR("Custom action (%s:%s) caused a page fault: %08x\n",
- debugstr_w(dll), debugstr_a(proc), GetExceptionCode());
- r = ERROR_SUCCESS;
- }
- __ENDTRY;
-
- MsiCloseHandle( hPackage );
+ r = custom_proc_wrapper( fn, hPackage );
}
- else
- ERR("failed to create handle for %x\n", remote_package );
+ __EXCEPT_PAGE_FAULT
+ {
+ ERR( "Custom action (%s:%s) caused a page fault: %08x\n",
+ debugstr_w(dll), debugstr_a(proc), GetExceptionCode() );
+ r = ERROR_SUCCESS;
+ }
+ __ENDTRY;
}
- else
- ERR("GetProcAddress(%s) failed\n", debugstr_a(proc));
FreeLibrary(hModule);
midl_user_free(dll);
midl_user_free(proc);
+ MsiCloseHandle(hPackage);
return r;
}
More information about the wine-cvs
mailing list