wshom: Use global memory allocation helpers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-02-28 08:56:04 +03:00 committed by Alexandre Julliard
parent 1db5170f49
commit f6bf269065
1 changed files with 18 additions and 17 deletions

View File

@ -24,6 +24,7 @@
#include "dispex.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wshom);
@ -130,7 +131,7 @@ static ULONG WINAPI WshExec_Release(IWshExec *iface)
if (!ref) {
CloseHandle(This->info.hThread);
CloseHandle(This->info.hProcess);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
@ -325,7 +326,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret)
*ret = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
@ -333,7 +334,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret)
This->ref = 1;
if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &This->info)) {
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return HRESULT_FROM_WIN32(GetLastError());
}
@ -383,7 +384,7 @@ static ULONG WINAPI WshEnvironment_Release(IWshEnvironment *iface)
TRACE("(%p) ref = %d\n", This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
@ -519,7 +520,7 @@ static HRESULT WshEnvironment_Create(IWshEnvironment **env)
{
WshEnvironment *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl;
@ -572,7 +573,7 @@ static ULONG WINAPI WshCollection_Release(IWshCollection *iface)
TRACE("(%p) ref = %d\n", This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
@ -721,7 +722,7 @@ static HRESULT WshCollection_Create(IWshCollection **collection)
{
WshCollection *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl;
@ -778,7 +779,7 @@ static ULONG WINAPI WshShortcut_Release(IWshShortcut *iface)
{
SysFreeString(This->path_link);
IShellLinkW_Release(This->link);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
@ -1077,7 +1078,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
*shortcut = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
@ -1087,7 +1088,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
&IID_IShellLinkW, (void**)&This->link);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return hr;
}
@ -1095,7 +1096,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
if (!This->path_link)
{
IShellLinkW_Release(This->link);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return E_OUTOFMEMORY;
}
@ -1426,7 +1427,7 @@ static HRESULT split_reg_path(const WCHAR *path, WCHAR **subkey, WCHAR **value)
unsigned int len = *value - *subkey - 1;
WCHAR *ret;
ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
ret = heap_alloc((len + 1)*sizeof(WCHAR));
if (!ret)
return E_OUTOFMEMORY;
@ -1466,7 +1467,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
if (ret == ERROR_SUCCESS) {
void *data;
data = HeapAlloc(GetProcessHeap(), 0, datalen);
data = heap_alloc(datalen);
if (!data) {
hr = E_OUTOFMEMORY;
goto fail;
@ -1474,7 +1475,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
ret = RegGetValueW(root, subkey, val, RRF_RT_ANY, &type, data, &datalen);
if (ret) {
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
hr = HRESULT_FROM_WIN32(ret);
goto fail;
}
@ -1564,7 +1565,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
hr = E_FAIL;
};
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
if (FAILED(hr))
VariantInit(value);
}
@ -1573,7 +1574,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v
fail:
if (val)
HeapFree(GetProcessHeap(), 0, subkey);
heap_free(subkey);
return hr;
}
@ -1661,7 +1662,7 @@ static HRESULT WINAPI WshShell3_RegWrite(IWshShell3 *iface, BSTR name, VARIANT *
fail:
VariantClear(&v);
if (val)
HeapFree(GetProcessHeap(), 0, subkey);
heap_free(subkey);
return hr;
}