[MSI]
[reactos.git] / reactos / dll / win32 / msi / custom.c
index aeab7b5..a750c7a 100644 (file)
@@ -203,8 +203,8 @@ static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL
     DWORD sz = MAX_PATH, write;
     UINT r;
 
-    if (msi_get_property(package->db, szTempFolder, fmt, &sz) != ERROR_SUCCESS)
-        GetTempPathW(MAX_PATH, fmt);
+    if (msi_get_property(package->db, szTempFolder, fmt, &sz) != ERROR_SUCCESS ||
+        GetFileAttributesW(fmt) == INVALID_FILE_ATTRIBUTES) GetTempPathW(MAX_PATH, fmt);
 
     if (!GetTempFileNameW( fmt, szMsi, 0, tmpfile ))
     {
@@ -991,7 +991,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;
@@ -1005,10 +1005,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)
@@ -1028,6 +1032,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;
 }