Hans Leidekker : msi: Consistently use the allocation macros.

Alexandre Julliard julliard at winehq.org
Thu May 20 11:03:02 CDT 2010


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu May 20 12:01:50 2010 +0200

msi: Consistently use the allocation macros.

---

 dlls/msi/automation.c |   12 ++++++------
 dlls/msi/custom.c     |    4 ++--
 dlls/msi/files.c      |    4 ++--
 dlls/msi/media.c      |    4 ++--
 dlls/msi/package.c    |   10 +++++-----
 dlls/msi/script.c     |    4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index f935a64..d6ef5c9 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -167,7 +167,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter
     if( pUnkOuter )
         return CLASS_E_NOAGGREGATION;
 
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AutomationObject)+sizetPrivateData);
+    object = msi_alloc_zero( sizeof(AutomationObject) + sizetPrivateData );
 
     /* Set all the VTable references */
     object->lpVtbl = &AutomationObject_Vtbl;
@@ -184,7 +184,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter
     object->iTypeInfo = NULL;
     hr = load_type_info((IDispatch *)object, &object->iTypeInfo, clsid, 0x0);
     if (FAILED(hr)) {
-        HeapFree(GetProcessHeap(), 0, object);
+        msi_free( object );
         return hr;
     }
 
@@ -203,7 +203,7 @@ static HRESULT create_list_enumerator(IUnknown *pUnkOuter, LPVOID *ppObj, Automa
     if( pUnkOuter )
         return CLASS_E_NOAGGREGATION;
 
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ListEnumerator));
+    object = msi_alloc_zero( sizeof(ListEnumerator) );
 
     /* Set all the VTable references */
     object->lpVtbl = &ListEnumerator_Vtbl;
@@ -288,7 +288,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface)
         if (This->funcFree) This->funcFree(This);
         ITypeInfo_Release(This->iTypeInfo);
         MsiCloseHandle(This->msiHandle);
-        HeapFree(GetProcessHeap(), 0, This);
+        msi_free(This);
     }
 
     return ref;
@@ -607,7 +607,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
     if (!ref)
     {
         if (This->pObj) IDispatch_Release((IDispatch *)This->pObj);
-        HeapFree(GetProcessHeap(), 0, This);
+        msi_free(This);
     }
 
     return ref;
@@ -1043,7 +1043,7 @@ static void WINAPI ListImpl_Free(AutomationObject *This)
 
     for (idx=0; idx<data->ulCount; idx++)
         VariantClear(&data->pVars[idx]);
-    HeapFree(GetProcessHeap(), 0, data->pVars);
+    msi_free(data->pVars);
 }
 
 static HRESULT WINAPI ViewImpl_Invoke(
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index cb67090..5a1787f 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -1417,7 +1417,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
     EnterCriticalSection( &msi_custom_action_cs );
 
     handle_count = list_count( &msi_pending_custom_actions );
-    wait_handles = HeapAlloc( GetProcessHeap(), 0, handle_count * sizeof(HANDLE) );
+    wait_handles = msi_alloc( handle_count * sizeof(HANDLE) );
 
     handle_count = 0;
     LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry )
@@ -1437,7 +1437,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
         CloseHandle( wait_handles[i] );
     }
 
-    HeapFree( GetProcessHeap(), 0, wait_handles );
+    msi_free( wait_handles );
 }
 
 typedef struct _msi_custom_remote_impl {
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index f66d815..052a158 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -148,7 +148,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
 
         GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
         len = strlenW(file->TargetPath) + strlenW(tmpfileW) + 1;
-        if (!(pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+        if (!(pathW = msi_alloc(len * sizeof(WCHAR))))
             return ERROR_OUTOFMEMORY;
 
         strcpyW(pathW, file->TargetPath);
@@ -168,7 +168,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
             gle = GetLastError();
             WARN("failed to schedule rename operation: %d)\n", gle);
         }
-        HeapFree(GetProcessHeap(), 0, pathW);
+        msi_free(pathW);
     }
 
     return gle;
diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 7cac9e7..49bc199 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -411,7 +411,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
 
             GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
             len = strlenW(path) + strlenW(tmpfileW) + 1;
-            if (!(tmppathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+            if (!(tmppathW = msi_alloc(len * sizeof(WCHAR))))
                 return ERROR_OUTOFMEMORY;
 
             strcpyW(tmppathW, path);
@@ -429,7 +429,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
             else
                 WARN("failed to schedule rename operation %s (error %d)\n", debugstr_w(path), GetLastError());
 
-            HeapFree(GetProcessHeap(), 0, tmppathW);
+            msi_free(tmppathW);
         }
         else
             WARN("failed to create %s (error %d)\n", debugstr_w(path), err);
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index c73a3ad..fba722f 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -893,11 +893,11 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_MORE_DATA)
     {
         WCHAR *username;
-        if ((username = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
+        if ((username = msi_alloc( len * sizeof(WCHAR) )))
         {
             if (GetUserNameW( username, &len ))
                 msi_set_property( package->db, szLogonUser, username );
-            HeapFree( GetProcessHeap(), 0, username );
+            msi_free( username );
         }
     }
 }
@@ -1113,16 +1113,16 @@ UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename )
     GetUrlCacheEntryInfoW( szUrl, NULL, &size );
     if ( GetLastError() != ERROR_FILE_NOT_FOUND )
     {
-        cache_entry = HeapAlloc( GetProcessHeap(), 0, size );
+        cache_entry = msi_alloc( size );
         if ( !GetUrlCacheEntryInfoW( szUrl, cache_entry, &size ) )
         {
             UINT error = GetLastError();
-            HeapFree( GetProcessHeap(), 0, cache_entry );
+            msi_free( cache_entry );
             return error;
         }
 
         lstrcpyW( filename, cache_entry->lpszLocalFileName );
-        HeapFree( GetProcessHeap(), 0, cache_entry );
+        msi_free( cache_entry );
         return ERROR_SUCCESS;
     }
 
diff --git a/dlls/msi/script.c b/dlls/msi/script.c
index 8dfa6d2..4f223da 100644
--- a/dlls/msi/script.c
+++ b/dlls/msi/script.c
@@ -62,7 +62,7 @@ static HRESULT create_ActiveScriptSite(IUnknown *pUnkOuter, LPVOID *ppObj)
     if( pUnkOuter )
         return CLASS_E_NOAGGREGATION;
 
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MsiActiveScriptSite));
+    object = msi_alloc_zero( sizeof(MsiActiveScriptSite) );
 
     object->lpVtbl.lpVtbl = &ASS_Vtbl;
     object->ref = 1;
@@ -236,7 +236,7 @@ static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface)
     TRACE("(%p/%p)\n", iface, This);
 
     if (!ref)
-        HeapFree(GetProcessHeap(), 0, This);
+        msi_free(This);
 
     return ref;
 }




More information about the wine-cvs mailing list