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

Alexandre Julliard julliard at winehq.org
Thu Nov 26 16:31:00 CST 2020


Module: wine
Branch: master
Commit: 8315486d641dac9ee4268450f68e5093bbc91235
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8315486d641dac9ee4268450f68e5093bbc91235

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Nov 26 15:07:33 2020 +0300

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

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/media_source.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 83424719d54..5c502cf3ed5 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1235,17 +1235,14 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
     GstStaticPadTemplate src_template =
         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;
+    struct media_source *object;
     gint64 total_pres_time = 0;
     DWORD bytestream_caps;
     unsigned int i;
     HRESULT hr;
     int ret;
 
-    if (!object)
-        return E_OUTOFMEMORY;
-
     if (FAILED(hr = IMFByteStream_GetCapabilities(bytestream, &bytestream_caps)))
         return hr;
 
@@ -1255,6 +1252,9 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
         return MF_E_BYTESTREAM_NOT_SEEKABLE;
     }
 
+    if (!(object = heap_alloc_zero(sizeof(*object))))
+        return E_OUTOFMEMORY;
+
     object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl;
     object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl;
     object->ref = 1;




More information about the wine-cvs mailing list