Commit baccba31 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

oleaut32: Don't call SafeArrayAllocData in LPSAFEARRAY_UserUnmarshal if we…

oleaut32: Don't call SafeArrayAllocData in LPSAFEARRAY_UserUnmarshal if we called SafeArrayCreateEx instead of SafeArrayAllocDescriptor. Otherwise, we'll leak memory.
parent 2ebee181
......@@ -1048,9 +1048,14 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
(*ppsa)->cbElements = wiresa->cbElements;
(*ppsa)->cLocks = LOWORD(wiresa->cLocks);
hr = SafeArrayAllocData(*ppsa);
if (FAILED(hr))
RpcRaiseException(hr);
/* SafeArrayCreateEx allocates the data for us, but
* SafeArrayAllocDescriptor doesn't */
if(!vt)
{
hr = SafeArrayAllocData(*ppsa);
if (FAILED(hr))
RpcRaiseException(hr);
}
if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
RpcRaiseException(RPC_S_INVALID_BOUND);
......
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