oleaut32: Don't call SafeArrayAllocData in LPSAFEARRAY_UserUnmarshal if we called SafeArrayCreateEx instead of SafeArrayAllocDescriptor.

Otherwise, we'll leak memory.
This commit is contained in:
Rob Shearman 2007-12-07 14:13:57 +00:00 committed by Alexandre Julliard
parent 2ebee18198
commit baccba317e
1 changed files with 8 additions and 3 deletions

View File

@ -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);