Commit 7f826081 authored by Alfred Agrell's avatar Alfred Agrell Committed by Alexandre Julliard

winegstreamer: Fix a memory leak in stream_props_GetMediaType.

parent 0ae5edc8
......@@ -555,16 +555,18 @@ static HRESULT WINAPI stream_props_GetMediaType(IWMMediaProps *iface, WM_MEDIA_T
return E_OUTOFMEMORY;
*size = sizeof(stream_mt) + stream_mt.cbFormat;
if (!mt)
return S_OK;
if (req_size < *size)
return ASF_E_BUFFERTOOSMALL;
if (mt && req_size >= *size)
{
strmbase_dump_media_type(&stream_mt);
strmbase_dump_media_type(&stream_mt);
memcpy(mt, &stream_mt, sizeof(*mt));
memcpy(mt + 1, stream_mt.pbFormat, stream_mt.cbFormat);
mt->pbFormat = (BYTE *)(mt + 1);
}
FreeMediaType(&stream_mt);
memcpy(mt, &stream_mt, sizeof(*mt));
memcpy(mt + 1, stream_mt.pbFormat, stream_mt.cbFormat);
mt->pbFormat = (BYTE *)(mt + 1);
if (mt && req_size < *size)
return ASF_E_BUFFERTOOSMALL;
return S_OK;
}
......
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