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