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

oleaut32: Use CoTaskMem* functions for safearrays.

parent 35a91741
......@@ -95,18 +95,18 @@ static const USHORT ignored_copy_features =
FADF_CREATEVECTOR;
/* Allocate memory */
static inline LPVOID SAFEARRAY_Malloc(ULONG ulSize)
static inline void* SAFEARRAY_Malloc(ULONG size)
{
/* FIXME: Memory should be allocated and freed using a per-thread IMalloc
* instance returned from CoGetMalloc().
*/
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulSize);
void *ret = CoTaskMemAlloc(size);
if (ret)
memset(ret, 0, size);
return ret;
}
/* Free memory */
static inline BOOL SAFEARRAY_Free(LPVOID lpData)
static inline void SAFEARRAY_Free(void *ptr)
{
return HeapFree(GetProcessHeap(), 0, lpData);
CoTaskMemFree(ptr);
}
/* Get the size of a supported VT type (0 means unsupported) */
......@@ -772,8 +772,7 @@ HRESULT WINAPI SafeArrayDestroyDescriptor(SAFEARRAY *psa)
!(psa->fFeatures & FADF_DATADELETED))
SAFEARRAY_DestroyData(psa, 0); /* Data not previously deleted */
if (!SAFEARRAY_Free(lpv))
return E_UNEXPECTED;
SAFEARRAY_Free(lpv);
}
return S_OK;
}
......@@ -1283,8 +1282,7 @@ HRESULT WINAPI SafeArrayDestroyData(SAFEARRAY *psa)
/* If this is not a vector, free the data memory block */
if (!(psa->fFeatures & FADF_CREATEVECTOR))
{
if (!SAFEARRAY_Free(psa->pvData))
return E_UNEXPECTED;
SAFEARRAY_Free(psa->pvData);
psa->pvData = NULL;
}
else
......
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