Commit fb083f4f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32/recinfo: Use CoTaskMem* allocations for the record data.

parent d9d66570
......@@ -524,7 +524,7 @@ static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
TRACE("(%p)\n", This);
record = HeapAlloc(GetProcessHeap(), 0, This->size);
record = CoTaskMemAlloc(This->size);
IRecordInfo_RecordInit(iface, record);
TRACE("created record at %p\n", record);
return record;
......@@ -555,9 +555,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordDestroy(IRecordInfo *iface, PVOID pv
if(FAILED(hres))
return hres;
if(!HeapFree(GetProcessHeap(), 0, pvRecord))
return E_INVALIDARG;
CoTaskMemFree(pvRecord);
return S_OK;
}
......
......@@ -686,11 +686,12 @@ static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, const VARIANT *src)
hr = IRecordInfo_GetSize(src_rec->pRecInfo, &size);
if (FAILED(hr)) return hr;
/* This could look cleaner if only RecordCreate() was used, but native doesn't use it.
Memory should be allocated in a same way as RecordCreate() does, so RecordDestroy()
/* Windows does not use RecordCreate() here, memory should be allocated in compatible way so RecordDestroy()
could free it later. */
dest_rec->pvRecord = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
dest_rec->pvRecord = CoTaskMemAlloc(size);
if (!dest_rec->pvRecord) return E_OUTOFMEMORY;
if (size)
memset(dest_rec->pvRecord, 0, size);
dest_rec->pRecInfo = src_rec->pRecInfo;
IRecordInfo_AddRef(src_rec->pRecInfo);
......
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