winegstreamer: Fix possible leak on error path (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-26 15:07:33 +03:00 committed by Alexandre Julliard
parent 0d16b018c2
commit 8315486d64
1 changed files with 4 additions and 4 deletions

View File

@ -1235,17 +1235,14 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
GstStaticPadTemplate src_template = GstStaticPadTemplate src_template =
GST_STATIC_PAD_TEMPLATE("mf_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); GST_STATIC_PAD_TEMPLATE("mf_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
struct media_source *object = heap_alloc_zero(sizeof(*object));
IMFStreamDescriptor **descriptors = NULL; IMFStreamDescriptor **descriptors = NULL;
struct media_source *object;
gint64 total_pres_time = 0; gint64 total_pres_time = 0;
DWORD bytestream_caps; DWORD bytestream_caps;
unsigned int i; unsigned int i;
HRESULT hr; HRESULT hr;
int ret; int ret;
if (!object)
return E_OUTOFMEMORY;
if (FAILED(hr = IMFByteStream_GetCapabilities(bytestream, &bytestream_caps))) if (FAILED(hr = IMFByteStream_GetCapabilities(bytestream, &bytestream_caps)))
return hr; return hr;
@ -1255,6 +1252,9 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
return MF_E_BYTESTREAM_NOT_SEEKABLE; return MF_E_BYTESTREAM_NOT_SEEKABLE;
} }
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl;
object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl; object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl;
object->ref = 1; object->ref = 1;