Commit 7a370c8d authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Consistently use the allocation macros.

parent 57a6b6fb
...@@ -167,7 +167,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter ...@@ -167,7 +167,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter
if( pUnkOuter ) if( pUnkOuter )
return CLASS_E_NOAGGREGATION; 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 */ /* Set all the VTable references */
object->lpVtbl = &AutomationObject_Vtbl; object->lpVtbl = &AutomationObject_Vtbl;
...@@ -184,7 +184,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter ...@@ -184,7 +184,7 @@ static HRESULT create_automation_object(MSIHANDLE msiHandle, IUnknown *pUnkOuter
object->iTypeInfo = NULL; object->iTypeInfo = NULL;
hr = load_type_info((IDispatch *)object, &object->iTypeInfo, clsid, 0x0); hr = load_type_info((IDispatch *)object, &object->iTypeInfo, clsid, 0x0);
if (FAILED(hr)) { if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, object); msi_free( object );
return hr; return hr;
} }
...@@ -203,7 +203,7 @@ static HRESULT create_list_enumerator(IUnknown *pUnkOuter, LPVOID *ppObj, Automa ...@@ -203,7 +203,7 @@ static HRESULT create_list_enumerator(IUnknown *pUnkOuter, LPVOID *ppObj, Automa
if( pUnkOuter ) if( pUnkOuter )
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ListEnumerator)); object = msi_alloc_zero( sizeof(ListEnumerator) );
/* Set all the VTable references */ /* Set all the VTable references */
object->lpVtbl = &ListEnumerator_Vtbl; object->lpVtbl = &ListEnumerator_Vtbl;
...@@ -288,7 +288,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface) ...@@ -288,7 +288,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface)
if (This->funcFree) This->funcFree(This); if (This->funcFree) This->funcFree(This);
ITypeInfo_Release(This->iTypeInfo); ITypeInfo_Release(This->iTypeInfo);
MsiCloseHandle(This->msiHandle); MsiCloseHandle(This->msiHandle);
HeapFree(GetProcessHeap(), 0, This); msi_free(This);
} }
return ref; return ref;
...@@ -607,7 +607,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) ...@@ -607,7 +607,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface)
if (!ref) if (!ref)
{ {
if (This->pObj) IDispatch_Release((IDispatch *)This->pObj); if (This->pObj) IDispatch_Release((IDispatch *)This->pObj);
HeapFree(GetProcessHeap(), 0, This); msi_free(This);
} }
return ref; return ref;
...@@ -1043,7 +1043,7 @@ static void WINAPI ListImpl_Free(AutomationObject *This) ...@@ -1043,7 +1043,7 @@ static void WINAPI ListImpl_Free(AutomationObject *This)
for (idx=0; idx<data->ulCount; idx++) for (idx=0; idx<data->ulCount; idx++)
VariantClear(&data->pVars[idx]); VariantClear(&data->pVars[idx]);
HeapFree(GetProcessHeap(), 0, data->pVars); msi_free(data->pVars);
} }
static HRESULT WINAPI ViewImpl_Invoke( static HRESULT WINAPI ViewImpl_Invoke(
......
...@@ -1417,7 +1417,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1417,7 +1417,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
EnterCriticalSection( &msi_custom_action_cs ); EnterCriticalSection( &msi_custom_action_cs );
handle_count = list_count( &msi_pending_custom_actions ); 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; handle_count = 0;
LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry ) 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) ...@@ -1437,7 +1437,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
CloseHandle( wait_handles[i] ); CloseHandle( wait_handles[i] );
} }
HeapFree( GetProcessHeap(), 0, wait_handles ); msi_free( wait_handles );
} }
typedef struct _msi_custom_remote_impl { typedef struct _msi_custom_remote_impl {
......
...@@ -148,7 +148,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -148,7 +148,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW); GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
len = strlenW(file->TargetPath) + strlenW(tmpfileW) + 1; 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; return ERROR_OUTOFMEMORY;
strcpyW(pathW, file->TargetPath); strcpyW(pathW, file->TargetPath);
...@@ -168,7 +168,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -168,7 +168,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
gle = GetLastError(); gle = GetLastError();
WARN("failed to schedule rename operation: %d)\n", gle); WARN("failed to schedule rename operation: %d)\n", gle);
} }
HeapFree(GetProcessHeap(), 0, pathW); msi_free(pathW);
} }
return gle; return gle;
......
...@@ -411,7 +411,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, ...@@ -411,7 +411,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW); GetTempFileNameW(szBackSlash, szMsi, 0, tmpfileW);
len = strlenW(path) + strlenW(tmpfileW) + 1; len = strlenW(path) + strlenW(tmpfileW) + 1;
if (!(tmppathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(tmppathW = msi_alloc(len * sizeof(WCHAR))))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
strcpyW(tmppathW, path); strcpyW(tmppathW, path);
...@@ -429,7 +429,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, ...@@ -429,7 +429,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
else else
WARN("failed to schedule rename operation %s (error %d)\n", debugstr_w(path), GetLastError()); WARN("failed to schedule rename operation %s (error %d)\n", debugstr_w(path), GetLastError());
HeapFree(GetProcessHeap(), 0, tmppathW); msi_free(tmppathW);
} }
else else
WARN("failed to create %s (error %d)\n", debugstr_w(path), err); WARN("failed to create %s (error %d)\n", debugstr_w(path), err);
......
...@@ -893,11 +893,11 @@ static VOID set_installer_properties(MSIPACKAGE *package) ...@@ -893,11 +893,11 @@ static VOID set_installer_properties(MSIPACKAGE *package)
if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_MORE_DATA) if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_MORE_DATA)
{ {
WCHAR *username; WCHAR *username;
if ((username = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) if ((username = msi_alloc( len * sizeof(WCHAR) )))
{ {
if (GetUserNameW( username, &len )) if (GetUserNameW( username, &len ))
msi_set_property( package->db, szLogonUser, username ); 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 ) ...@@ -1113,16 +1113,16 @@ UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename )
GetUrlCacheEntryInfoW( szUrl, NULL, &size ); GetUrlCacheEntryInfoW( szUrl, NULL, &size );
if ( GetLastError() != ERROR_FILE_NOT_FOUND ) if ( GetLastError() != ERROR_FILE_NOT_FOUND )
{ {
cache_entry = HeapAlloc( GetProcessHeap(), 0, size ); cache_entry = msi_alloc( size );
if ( !GetUrlCacheEntryInfoW( szUrl, cache_entry, &size ) ) if ( !GetUrlCacheEntryInfoW( szUrl, cache_entry, &size ) )
{ {
UINT error = GetLastError(); UINT error = GetLastError();
HeapFree( GetProcessHeap(), 0, cache_entry ); msi_free( cache_entry );
return error; return error;
} }
lstrcpyW( filename, cache_entry->lpszLocalFileName ); lstrcpyW( filename, cache_entry->lpszLocalFileName );
HeapFree( GetProcessHeap(), 0, cache_entry ); msi_free( cache_entry );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -62,7 +62,7 @@ static HRESULT create_ActiveScriptSite(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -62,7 +62,7 @@ static HRESULT create_ActiveScriptSite(IUnknown *pUnkOuter, LPVOID *ppObj)
if( pUnkOuter ) if( pUnkOuter )
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MsiActiveScriptSite)); object = msi_alloc_zero( sizeof(MsiActiveScriptSite) );
object->lpVtbl.lpVtbl = &ASS_Vtbl; object->lpVtbl.lpVtbl = &ASS_Vtbl;
object->ref = 1; object->ref = 1;
...@@ -236,7 +236,7 @@ static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface) ...@@ -236,7 +236,7 @@ static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface)
TRACE("(%p/%p)\n", iface, This); TRACE("(%p/%p)\n", iface, This);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, This); msi_free(This);
return ref; return ref;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment