Nikolay Sivov : wshom: Use global memory allocation helpers.
Alexandre Julliard
julliard at winehq.org
Wed Feb 28 15:39:33 CST 2018
Module: wine
Branch: master
Commit: f6bf26906547200a6cc23e6e139e357f440dc605
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f6bf26906547200a6cc23e6e139e357f440dc605
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Feb 28 08:56:04 2018 +0300
wshom: Use global memory allocation helpers.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wshom.ocx/shell.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index d7b36cf..1aa353a 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -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;
}
More information about the wine-cvs
mailing list