Nikolay Sivov : msi: Fix a record leak on error paths (Coverity).

Alexandre Julliard julliard at winehq.org
Thu Mar 27 14:40:05 CDT 2014


Module: wine
Branch: master
Commit: dc33b1358115a7fef739e77ede1be48e3d94078f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dc33b1358115a7fef739e77ede1be48e3d94078f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar 27 06:55:24 2014 +0400

msi: Fix a record leak on error paths (Coverity).

---

 dlls/msi/custom.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 63bec19..002d861 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -1003,7 +1003,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons
         'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
         '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
         '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
-    MSIRECORD *row = 0;
+    MSIRECORD *row = NULL;
     msi_custom_action_info *info;
     CHAR *buffer = NULL;
     WCHAR *bufferw = NULL;
@@ -1017,10 +1017,14 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons
         return ERROR_FUNCTION_FAILED;
 
     r = MSI_RecordReadStream(row, 2, NULL, &sz);
-    if (r != ERROR_SUCCESS) return r;
+    if (r != ERROR_SUCCESS) goto done;
 
     buffer = msi_alloc( sz + 1 );
-    if (!buffer) return ERROR_FUNCTION_FAILED;
+    if (!buffer)
+    {
+       r = ERROR_FUNCTION_FAILED;
+       goto done;
+    }
 
     r = MSI_RecordReadStream(row, 2, buffer, &sz);
     if (r != ERROR_SUCCESS)
@@ -1040,6 +1044,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons
 done:
     msi_free(bufferw);
     msi_free(buffer);
+    msiobj_release(&row->hdr);
     return r;
 }
 




More information about the wine-cvs mailing list