Commit 9d1beee6 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

combase: Use CRT memory allocation functions.

parent 0f9ad11a
......@@ -160,9 +160,9 @@ static HRESULT apartment_add_dll(const WCHAR *library_name, struct opendll **ret
else
{
len = lstrlenW(library_name);
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
if (entry)
entry->library_name = heap_alloc((len + 1) * sizeof(WCHAR));
entry->library_name = malloc((len + 1) * sizeof(WCHAR));
if (entry && entry->library_name)
{
memcpy(entry->library_name, library_name, (len + 1)*sizeof(WCHAR));
......@@ -175,7 +175,7 @@ static HRESULT apartment_add_dll(const WCHAR *library_name, struct opendll **ret
}
else
{
heap_free(entry);
free(entry);
hr = E_OUTOFMEMORY;
FreeLibrary(hLibrary);
}
......@@ -199,8 +199,8 @@ static void apartment_release_dll(struct opendll *entry, BOOL free_entry)
TRACE("freeing %p\n", entry->library);
FreeLibrary(entry->library);
heap_free(entry->library_name);
heap_free(entry);
free(entry->library_name);
free(entry);
}
}
......@@ -212,8 +212,8 @@ static void apartment_release_dlls(void)
LIST_FOR_EACH_ENTRY_SAFE(entry, cursor2, &dlls, struct opendll, entry)
{
list_remove(&entry->entry);
heap_free(entry->library_name);
heap_free(entry);
free(entry->library_name);
free(entry);
}
LeaveCriticalSection(&dlls_cs);
DeleteCriticalSection(&dlls_cs);
......@@ -279,7 +279,7 @@ static ULONG WINAPI local_server_Release(IServiceProvider *iface)
if (!refcount)
{
assert(!local_server->apt);
heap_free(local_server);
free(local_server);
}
return refcount;
......@@ -324,7 +324,7 @@ HRESULT apartment_get_local_server_stream(struct apartment *apt, IStream **ret)
{
struct local_server *obj;
obj = heap_alloc(sizeof(*obj));
obj = malloc(sizeof(*obj));
if (obj)
{
obj->IServiceProvider_iface.lpVtbl = &local_server_vtbl;
......@@ -343,7 +343,7 @@ HRESULT apartment_get_local_server_stream(struct apartment *apt, IStream **ret)
if (SUCCEEDED(hr))
apt->local_server = obj;
else
heap_free(obj);
free(obj);
}
else
hr = E_OUTOFMEMORY;
......@@ -367,7 +367,7 @@ static struct apartment *apartment_construct(DWORD model)
TRACE("creating new apartment, model %ld\n", model);
apt = heap_alloc_zero(sizeof(*apt));
apt = calloc(1, sizeof(*apt));
apt->tid = GetCurrentThreadId();
list_init(&apt->proxies);
......@@ -429,7 +429,7 @@ void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
{
list_remove(&entry->entry);
apartment_release_dll(entry->dll, TRUE);
heap_free(entry);
free(entry);
}
else
{
......@@ -531,13 +531,13 @@ void apartment_release(struct apartment *apt)
struct apartment_loaded_dll *apartment_loaded_dll = LIST_ENTRY(cursor, struct apartment_loaded_dll, entry);
apartment_release_dll(apartment_loaded_dll->dll, FALSE);
list_remove(cursor);
heap_free(apartment_loaded_dll);
free(apartment_loaded_dll);
}
apt->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&apt->cs);
heap_free(apt);
free(apt);
}
}
......@@ -796,7 +796,7 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath,
if (!found)
{
apartment_loaded_dll = heap_alloc(sizeof(*apartment_loaded_dll));
apartment_loaded_dll = malloc(sizeof(*apartment_loaded_dll));
if (!apartment_loaded_dll)
hr = E_OUTOFMEMORY;
if (SUCCEEDED(hr))
......@@ -805,7 +805,7 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath,
apartment_loaded_dll->multi_threaded = FALSE;
hr = apartment_add_dll(dllpath, &apartment_loaded_dll->dll);
if (FAILED(hr))
heap_free(apartment_loaded_dll);
free(apartment_loaded_dll);
}
if (SUCCEEDED(hr))
{
......@@ -1175,7 +1175,7 @@ HRESULT apartment_increment_mta_usage(CO_MTA_USAGE_COOKIE *cookie)
*cookie = NULL;
if (!(mta_cookie = heap_alloc(sizeof(*mta_cookie))))
if (!(mta_cookie = malloc(sizeof(*mta_cookie))))
return E_OUTOFMEMORY;
EnterCriticalSection(&apt_cs);
......@@ -1208,7 +1208,7 @@ void apartment_decrement_mta_usage(CO_MTA_USAGE_COOKIE cookie)
if (mta_cookie == cur)
{
list_remove(&cur->entry);
heap_free(cur);
free(cur);
apartment_release(mta);
break;
}
......
......@@ -32,7 +32,6 @@
#include "combase_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
......@@ -392,7 +391,7 @@ BOOL WINAPI InternalIsProcessInitialized(void)
*/
HRESULT WINAPI InternalTlsAllocData(struct tlsdata **data)
{
if (!(*data = heap_alloc_zero(sizeof(**data))))
if (!(*data = calloc(1, sizeof(**data))))
return E_OUTOFMEMORY;
list_init(&(*data)->spies);
......@@ -421,13 +420,13 @@ static void com_cleanup_tlsdata(void)
list_remove(&cursor->entry);
if (cursor->spy)
IInitializeSpy_Release(cursor->spy);
heap_free(cursor);
free(cursor);
}
if (tlsdata->context_token)
IObjContext_Release(tlsdata->context_token);
heap_free(tlsdata);
free(tlsdata);
NtCurrentTeb()->ReservedForOle = NULL;
}
......@@ -478,7 +477,7 @@ static ULONG WINAPI global_options_Release(IGlobalOptions *iface)
TRACE("%p, refcount %ld.\n", iface, refcount);
if (!refcount)
heap_free(options);
free(options);
return refcount;
}
......@@ -552,7 +551,7 @@ static HRESULT WINAPI global_options_CreateInstance(IClassFactory *iface, IUnkno
if (outer)
return E_INVALIDARG;
if (!(object = heap_alloc(sizeof(*object))))
if (!(object = malloc(sizeof(*object))))
return E_OUTOFMEMORY;
object->IGlobalOptions_iface.lpVtbl = &global_options_vtbl;
object->refcount = 1;
......@@ -1393,18 +1392,18 @@ static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
WCHAR *buf;
memset(clsid, 0, sizeof(*clsid));
buf = heap_alloc((lstrlenW(progid) + 8) * sizeof(WCHAR));
buf = malloc((lstrlenW(progid) + 8) * sizeof(WCHAR));
if (!buf) return E_OUTOFMEMORY;
lstrcpyW(buf, progid);
lstrcatW(buf, L"\\CLSID");
if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey))
{
heap_free(buf);
free(buf);
WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
return CO_E_CLASSSTRING;
}
heap_free(buf);
free(buf);
if (RegQueryValueW(xhkey, NULL, buf2, &buf2len))
{
......@@ -1984,7 +1983,7 @@ HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cook
if (FAILED(hr))
return hr;
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
if (!entry)
{
IInitializeSpy_Release(spy);
......@@ -2032,7 +2031,7 @@ HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
if (!tlsdata->spies_lock)
{
list_remove(&spy->entry);
heap_free(spy);
free(spy);
}
return S_OK;
}
......@@ -2245,7 +2244,7 @@ static void com_revoke_all_ps_clsids(void)
LIST_FOR_EACH_ENTRY_SAFE(cur, cur2, &registered_proxystubs, struct registered_ps, entry)
{
list_remove(&cur->entry);
heap_free(cur);
free(cur);
}
LeaveCriticalSection(&cs_registered_ps);
......@@ -2365,7 +2364,7 @@ HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
}
}
cur = heap_alloc(sizeof(*cur));
cur = malloc(sizeof(*cur));
if (!cur)
{
LeaveCriticalSection(&cs_registered_ps);
......@@ -2448,7 +2447,7 @@ static ULONG WINAPI thread_context_info_Release(IComThreadingInfo *iface)
releasing context while refcount is at 0 destroys it. */
if (!context->refcount)
{
heap_free(context);
free(context);
return 0;
}
......@@ -2673,7 +2672,7 @@ HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
{
struct thread_context *context;
context = heap_alloc_zero(sizeof(*context));
context = calloc(1, sizeof(*context));
if (!context)
return E_OUTOFMEMORY;
......@@ -2768,7 +2767,7 @@ static void unlock_init_spies(struct tlsdata *tlsdata)
{
if (spy->spy) continue;
list_remove(&spy->entry);
heap_free(spy);
free(spy);
}
}
......@@ -3001,7 +3000,7 @@ HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, IUnknown *object, DWORD cl
return CO_E_OBJISREG;
}
newclass = heap_alloc_zero(sizeof(*newclass));
newclass = calloc(1, sizeof(*newclass));
if (!newclass)
{
apartment_release(apt);
......@@ -3052,7 +3051,7 @@ static void com_revoke_class_object(struct registered_class *entry)
rpc_revoke_local_server(entry->rpcss_cookie);
IUnknown_Release(entry->object);
heap_free(entry);
free(entry);
}
/* Cleans up rpcss registry */
......
......@@ -17,7 +17,6 @@
#include "winternl.h"
#include "wine/orpc.h"
#include "wine/heap.h"
#include "wine/list.h"
extern HINSTANCE hProxyDll;
......
......@@ -25,27 +25,9 @@
#include "combase_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
static WCHAR *heap_strdupW(const WCHAR *str)
{
WCHAR *ret = NULL;
if (str)
{
size_t size;
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if (ret)
memcpy(ret, str, size);
}
return ret;
}
struct error_info
{
IErrorInfo IErrorInfo_iface;
......@@ -125,10 +107,10 @@ static ULONG WINAPI errorinfo_Release(IErrorInfo *iface)
if (!refcount)
{
heap_free(error_info->source);
heap_free(error_info->description);
heap_free(error_info->help_file);
heap_free(error_info);
free(error_info->source);
free(error_info->description);
free(error_info->help_file);
free(error_info);
}
return refcount;
......@@ -241,8 +223,8 @@ static HRESULT WINAPI create_errorinfo_SetSource(ICreateErrorInfo *iface, LPOLES
TRACE("%p, %s.\n", iface, debugstr_w(source));
heap_free(error_info->source);
error_info->source = heap_strdupW(source);
free(error_info->source);
error_info->source = wcsdup(source);
return S_OK;
}
......@@ -253,8 +235,8 @@ static HRESULT WINAPI create_errorinfo_SetDescription(ICreateErrorInfo *iface, L
TRACE("%p, %s.\n", iface, debugstr_w(description));
heap_free(error_info->description);
error_info->description = heap_strdupW(description);
free(error_info->description);
error_info->description = wcsdup(description);
return S_OK;
}
......@@ -265,8 +247,8 @@ static HRESULT WINAPI create_errorinfo_SetHelpFile(ICreateErrorInfo *iface, LPOL
TRACE("%p, %s.\n", iface, debugstr_w(helpfile));
heap_free(error_info->help_file);
error_info->help_file = heap_strdupW(helpfile);
free(error_info->help_file);
error_info->help_file = wcsdup(helpfile);
return S_OK;
}
......@@ -340,7 +322,7 @@ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **ret)
if (!ret) return E_INVALIDARG;
if (!(error_info = heap_alloc(sizeof(*error_info))))
if (!(error_info = malloc(sizeof(*error_info))))
return E_OUTOFMEMORY;
error_info->IErrorInfo_iface.lpVtbl = &errorinfo_vtbl;
......
......@@ -48,7 +48,7 @@ static void handle_release(struct handle_wrapper *handle)
if (!ref)
{
if (handle->delete_on_release) GlobalFree(handle->hglobal);
HeapFree(GetProcessHeap(), 0, handle);
free(handle);
}
}
......@@ -56,14 +56,14 @@ static struct handle_wrapper *handle_create(HGLOBAL hglobal, BOOL delete_on_rele
{
struct handle_wrapper *handle;
handle = HeapAlloc(GetProcessHeap(), 0, sizeof(*handle));
handle = malloc(sizeof(*handle));
if (!handle) return NULL;
/* allocate a handle if one is not supplied */
if (!hglobal) hglobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD | GMEM_SHARE, 0);
if (!hglobal)
{
HeapFree(GetProcessHeap(), 0, handle);
free(handle);
return NULL;
}
handle->ref = 1;
......@@ -92,7 +92,7 @@ static const IStreamVtbl hglobalstreamvtbl;
static struct hglobal_stream *hglobalstream_construct(void)
{
struct hglobal_stream *object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
struct hglobal_stream *object = calloc(1, sizeof(*object));
if (object)
{
......@@ -134,7 +134,7 @@ static ULONG WINAPI stream_Release(IStream *iface)
if (!ref)
{
handle_release(stream->handle);
HeapFree(GetProcessHeap(), 0, stream);
free(stream);
}
return ref;
......@@ -422,7 +422,7 @@ HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IS
object->handle = handle_create(hGlobal, delete_on_release);
if (!object->handle)
{
HeapFree(GetProcessHeap(), 0, object);
free(object);
return E_OUTOFMEMORY;
}
......
......@@ -21,7 +21,6 @@
#include "oleauto.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(olemalloc);
......
......@@ -28,7 +28,6 @@
#include "combase_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
......@@ -219,7 +218,7 @@ static ULONG WINAPI ftmarshaler_inner_Release(IUnknown *iface)
TRACE("%p, refcount %lu\n", iface, refcount);
if (!refcount)
heap_free(marshaler);
free(marshaler);
return refcount;
}
......@@ -421,7 +420,7 @@ HRESULT WINAPI CoCreateFreeThreadedMarshaler(IUnknown *outer, IUnknown **marshal
TRACE("%p, %p\n", outer, marshaler);
object = heap_alloc(sizeof(*object));
object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......@@ -1001,9 +1000,9 @@ static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, UL
ULONG nonlocal_mqis = 0;
ULONG i;
ULONG successful_mqis = 0;
IID *iids = HeapAlloc(GetProcessHeap(), 0, cMQIs * sizeof(*iids));
IID *iids = malloc(cMQIs * sizeof(*iids));
/* mapping of RemQueryInterface index to QueryMultipleInterfaces index */
ULONG *mapping = HeapAlloc(GetProcessHeap(), 0, cMQIs * sizeof(*mapping));
ULONG *mapping = malloc(cMQIs * sizeof(*mapping));
TRACE("cMQIs: %ld\n", cMQIs);
......@@ -1084,8 +1083,8 @@ static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, UL
TRACE("%ld/%ld successfully queried\n", successful_mqis, cMQIs);
HeapFree(GetProcessHeap(), 0, iids);
HeapFree(GetProcessHeap(), 0, mapping);
free(iids);
free(mapping);
if (successful_mqis == cMQIs)
return S_OK; /* we got all requested interfaces */
......@@ -1531,20 +1530,20 @@ static void ifproxy_destroy(struct ifproxy * This)
if (This->proxy) IRpcProxyBuffer_Release(This->proxy);
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
static HRESULT proxy_manager_construct(
struct apartment * apt, ULONG sorflags, OXID oxid, OID oid,
const OXID_INFO *oxid_info, struct proxy_manager ** proxy_manager)
{
struct proxy_manager * This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
struct proxy_manager * This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->remoting_mutex = CreateMutexW(NULL, FALSE, NULL);
if (!This->remoting_mutex)
{
HeapFree(GetProcessHeap(), 0, This);
free(This);
return HRESULT_FROM_WIN32(GetLastError());
}
......@@ -1562,7 +1561,7 @@ static HRESULT proxy_manager_construct(
if (FAILED(hr))
{
CloseHandle(This->remoting_mutex);
HeapFree(GetProcessHeap(), 0, This);
free(This);
return hr;
}
}
......@@ -1718,7 +1717,7 @@ static HRESULT proxy_manager_create_ifproxy(
{
HRESULT hr;
IPSFactoryBuffer * psfb;
struct ifproxy * ifproxy = HeapAlloc(GetProcessHeap(), 0, sizeof(*ifproxy));
struct ifproxy * ifproxy = malloc(sizeof(*ifproxy));
if (!ifproxy) return E_OUTOFMEMORY;
list_init(&ifproxy->entry);
......@@ -1931,7 +1930,7 @@ static void proxy_manager_destroy(struct proxy_manager * This)
CloseHandle(This->remoting_mutex);
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
/* finds the proxy manager corresponding to a given OXID and OID that has
......@@ -2014,7 +2013,7 @@ static ULONG WINAPI StdMarshalImpl_Release(IMarshal *iface)
ULONG refcount = InterlockedDecrement(&marshal->refcount);
if (!refcount)
heap_free(marshal);
free(marshal);
return refcount;
}
......@@ -2215,7 +2214,7 @@ static HRESULT StdMarshalImpl_Construct(REFIID riid, DWORD dest_context, void *d
struct stdmarshal *object;
HRESULT hr;
object = heap_alloc(sizeof(*object));
object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......
......@@ -69,7 +69,7 @@ static HRESULT get_library_for_classid(const WCHAR *classid, WCHAR **out)
hr = REGDB_E_READREGDB;
goto done;
}
if (!(buf = HeapAlloc(GetProcessHeap(), 0, size)))
if (!(buf = malloc(size)))
{
hr = E_OUTOFMEMORY;
goto done;
......@@ -83,13 +83,13 @@ static HRESULT get_library_for_classid(const WCHAR *classid, WCHAR **out)
{
WCHAR *expanded;
DWORD len = ExpandEnvironmentStringsW(buf, NULL, 0);
if (!(expanded = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
if (!(expanded = malloc(len * sizeof(WCHAR))))
{
hr = E_OUTOFMEMORY;
goto done;
}
ExpandEnvironmentStringsW(buf, expanded, len);
HeapFree(GetProcessHeap(), 0, buf);
free(buf);
buf = expanded;
}
......@@ -97,7 +97,7 @@ static HRESULT get_library_for_classid(const WCHAR *classid, WCHAR **out)
return S_OK;
done:
HeapFree(GetProcessHeap(), 0, buf);
free(buf);
RegCloseKey(hkey_class);
return hr;
}
......@@ -178,7 +178,7 @@ HRESULT WINAPI RoGetActivationFactory(HSTRING classid, REFIID iid, void **class_
}
done:
HeapFree(GetProcessHeap(), 0, library);
free(library);
if (module) FreeLibrary(module);
return hr;
}
......
......@@ -66,7 +66,7 @@ static inline struct hstring_private *impl_from_HSTRING_BUFFER(HSTRING_BUFFER bu
static BOOL alloc_string(UINT32 len, HSTRING *out)
{
struct hstring_private *priv;
priv = HeapAlloc(GetProcessHeap(), 0, offsetof(struct hstring_private, buffer[len+1]));
priv = malloc(offsetof(struct hstring_private, buffer[len+1]));
if (!priv)
return FALSE;
......@@ -151,7 +151,7 @@ HRESULT WINAPI WindowsDeleteString(HSTRING str)
if (priv->header.flags & HSTRING_REFERENCE_FLAG)
return S_OK;
if (InterlockedDecrement(&priv->refcount) == 0)
HeapFree(GetProcessHeap(), 0, priv);
free(priv);
return S_OK;
}
......
......@@ -77,13 +77,13 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *
TRACE("oid=%s, stubbuffer=%p, iid=%s, dest_context=%lx\n", wine_dbgstr_longlong(m->oid), sb,
debugstr_guid(iid), dest_context);
stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
stub = calloc(1, sizeof(struct ifstub));
if (!stub) return NULL;
hr = IUnknown_QueryInterface(m->object, iid, (void **)&stub->iface);
if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, stub);
free(stub);
return NULL;
}
......@@ -91,7 +91,7 @@ struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *
if (hr != S_OK)
{
IUnknown_Release(stub->iface);
HeapFree(GetProcessHeap(), 0, stub);
free(stub);
return NULL;
}
......@@ -132,7 +132,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
IUnknown_Release(ifstub->iface);
IRpcChannelBuffer_Release(ifstub->chan);
HeapFree(GetProcessHeap(), 0, ifstub);
free(ifstub);
}
static struct ifstub *stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid)
......@@ -182,7 +182,7 @@ static struct stub_manager *new_stub_manager(struct apartment *apt, IUnknown *ob
assert(apt);
sm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct stub_manager));
sm = calloc(1, sizeof(struct stub_manager));
if (!sm) return NULL;
list_init(&sm->ifstubs);
......@@ -288,7 +288,7 @@ static void stub_manager_delete(struct stub_manager *m)
m->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&m->lock);
HeapFree(GetProcessHeap(), 0, m);
free(m);
}
/* increments the internal refcount */
......@@ -634,7 +634,7 @@ static inline RemUnknown *impl_from_IRemUnknown(IRemUnknown *iface)
/* construct an IRemUnknown object with one outstanding reference */
static HRESULT RemUnknown_Construct(IRemUnknown **ppRemUnknown)
{
RemUnknown *object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
RemUnknown *object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......@@ -683,7 +683,7 @@ static ULONG WINAPI RemUnknown_Release(IRemUnknown *iface)
refs = InterlockedDecrement(&remunk->refs);
if (!refs)
HeapFree(GetProcessHeap(), 0, remunk);
free(remunk);
TRACE("%p after: %ld\n", iface, refs);
return refs;
......
......@@ -494,7 +494,7 @@ unsigned char * __RPC_USER HBITMAP_UserUnmarshal(ULONG *flags, unsigned char *bu
bitmap_size = *(ULONG *)buffer;
buffer += sizeof(ULONG);
bits = HeapAlloc(GetProcessHeap(), 0, bitmap_size);
bits = malloc(bitmap_size);
memcpy(&bitmap, buffer, header_size);
buffer += header_size;
......@@ -505,7 +505,7 @@ unsigned char * __RPC_USER HBITMAP_UserUnmarshal(ULONG *flags, unsigned char *bu
bitmap.bmBits = bits;
*bmp = CreateBitmapIndirect(&bitmap);
HeapFree(GetProcessHeap(), 0, bits);
free(bits);
}
else
*bmp = NULL;
......
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