msi: Fix some leaks (coverity)
Frédéric Delanoy
frederic.delanoy at gmail.com
Mon Nov 5 18:02:58 CST 2012
CIDs 713676 713583 713586 713589 713599
---
dlls/msi/msi.c | 3 +++
dlls/msi/package.c | 12 ++++++++++--
dlls/msi/source.c | 3 +++
dlls/msi/suminfo.c | 8 ++++++++
dlls/msi/where.c | 2 ++
5 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 4bcb5c5..92ef52c 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -2215,7 +2215,10 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
if (!(val = msi_alloc( sz ))) return ERROR_OUTOFMEMORY;
if ((r = msi_comp_find_prodcode(squished_pc, dwContext, szComponent, val, &sz)))
+ {
+ msi_free(val);
return r;
+ }
if (lstrlenW(val) > 2 &&
val[0] >= '0' && val[0] <= '9' && val[1] >= '0' && val[1] <= '9' && val[2] != ':')
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index f398c10..33a8a25 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -638,10 +638,18 @@ static void set_msi_assembly_prop(MSIPACKAGE *package)
return;
size = GetFileVersionInfoSizeW(fusion, &handle);
- if (!size) return;
+ if (!size)
+ {
+ msi_free(fusion);
+ return;
+ }
version = msi_alloc(size);
- if (!version) return;
+ if (!version)
+ {
+ msi_free(fusion);
+ return;
+ }
if (!GetFileVersionInfoW(fusion, handle, size, version))
goto done;
diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index 881f3d2..ab8541c 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -763,7 +763,10 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE);
if (r != ERROR_SUCCESS)
+ {
+ msi_free(buffer);
return r;
+ }
sprintfW(buffer, format, typechar, index, value);
diff --git a/dlls/msi/suminfo.c b/dlls/msi/suminfo.c
index e0c99b8..27fb25d 100644
--- a/dlls/msi/suminfo.c
+++ b/dlls/msi/suminfo.c
@@ -151,15 +151,23 @@ static UINT propvar_changetype(PROPVARIANT *changed, PROPVARIANT *property, VART
{
HRESULT hr;
HMODULE propsys = LoadLibraryA("propsys.dll");
+
+ if (!propsys)
+ {
+ ERR("Failed to load propsys.dll: %u\n", GetLastError());
+ return ERROR_DLL_NOT_FOUND;
+ }
pPropVariantChangeType = (void *)GetProcAddress(propsys, "PropVariantChangeType");
if (!pPropVariantChangeType)
{
ERR("PropVariantChangeType function missing!\n");
+ FreeLibrary(propsys);
return ERROR_FUNCTION_FAILED;
}
hr = pPropVariantChangeType(changed, property, 0, vt);
+ FreeLibrary(propsys);
return (hr == S_OK) ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED;
}
diff --git a/dlls/msi/where.c b/dlls/msi/where.c
index 45fda44..1bf7788 100644
--- a/dlls/msi/where.c
+++ b/dlls/msi/where.c
@@ -1253,6 +1253,8 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
if (r != ERROR_SUCCESS)
{
ERR("can't get table dimensions\n");
+ table->view->ops->delete(table->view);
+ msi_free(table);
goto end;
}
--
1.8.0
More information about the wine-patches
mailing list