Commit 07729ea4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Avoid leaking the media type on failure in IEnumMediaTypes::Next().

parent 2cf4b601
......@@ -119,6 +119,7 @@ static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count,
AM_MEDIA_TYPE **mts, ULONG *ret_count)
{
struct enum_media_types *enummt = impl_from_IEnumMediaTypes(iface);
AM_MEDIA_TYPE mt;
unsigned int i;
HRESULT hr;
......@@ -133,10 +134,14 @@ static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count,
for (i = 0; i < count; ++i)
{
if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
hr = enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->index + i, mts[i]);
else
hr = E_OUTOFMEMORY;
hr = enummt->pin->ops->pin_get_media_type(enummt->pin, enummt->index + i, &mt);
if (hr == S_OK)
{
if ((mts[i] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
*mts[i] = mt;
else
hr = E_OUTOFMEMORY;
}
if (FAILED(hr))
{
while (i--)
......
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