msi: Fix some leaks (coverity)

Frédéric Delanoy frederic.delanoy at gmail.com
Wed Nov 7 18:32:27 CST 2012


CIDs 713568 713577-713578 713582 716414-716420
---
 dlls/msi/action.c  | 10 ++++++++++
 dlls/msi/files.c   |  2 ++
 dlls/msi/package.c |  3 +++
 3 files changed, 15 insertions(+)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index f9ab550..8a6c952 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5809,7 +5809,16 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
     {
         int len = strlenW(file->TargetPath) + strlenW(args) + 2;
         if (!(image_path = msi_alloc(len * sizeof(WCHAR))))
+        {
+            msi_free(name);
+            msi_free(disp);
+            msi_free(load_order);
+            msi_free(serv_name);
+            msi_free(pass);
+            msi_free(depends);
+            msi_free(args);
             return ERROR_OUTOFMEMORY;
+        }
 
         strcpyW(image_path, file->TargetPath);
         strcatW(image_path, szSpace);
@@ -6070,6 +6079,7 @@ static BOOL stop_service_dependents(SC_HANDLE scm, SC_HANDLE service)
             goto error;
     }
 
+    msi_free(dependencies);
     return TRUE;
 
 error:
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 11913ef..98d7513 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -336,6 +336,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
         if (rc != ERROR_SUCCESS)
         {
             ERR("Unable to load media info for %s (%u)\n", debugstr_w(file->File), rc);
+            msi_free(mi);
             return ERROR_FUNCTION_FAILED;
         }
         if (!file->Component->Enabled) continue;
@@ -513,6 +514,7 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package )
         if (rc != ERROR_SUCCESS)
         {
             ERR("Unable to load media info for %s (%u)\n", debugstr_w(file->File), rc);
+            msi_free(mi);
             return ERROR_FUNCTION_FAILED;
         }
         comp->Action = msi_get_component_action( package, comp );
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 015af00..b7b1fca 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -1581,7 +1581,10 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
         TRACE("opening package %s\n", debugstr_w( localfile ));
         r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db );
         if (r != ERROR_SUCCESS)
+        {
+            msi_free(base_url);
             return r;
+        }
     }
     package = MSI_CreatePackage( db, base_url );
     msi_free( base_url );
-- 
1.8.0




More information about the wine-patches mailing list