Zebediah Figura : winegstreamer: Clean up a newly allocated buffer on error in bytestream_wrapper_pull().

Alexandre Julliard julliard at winehq.org
Mon Dec 7 15:51:32 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sat Dec  5 10:32:17 2020 -0600

winegstreamer: Clean up a newly allocated buffer on error in bytestream_wrapper_pull().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/media_source.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 5c502cf3ed5..a9a85cf4d4b 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -441,6 +441,7 @@ GstFlowReturn bytestream_wrapper_pull(GstPad *pad, GstObject *parent, guint64 of
 {
     struct media_source *source = gst_pad_get_element_private(pad);
     IMFByteStream *byte_stream = source->byte_stream;
+    GstBuffer *new_buffer = NULL;
     ULONG bytes_read;
     GstMapInfo info;
     BOOL is_eof;
@@ -460,7 +461,7 @@ GstFlowReturn bytestream_wrapper_pull(GstPad *pad, GstObject *parent, guint64 of
         return GST_FLOW_EOS;
 
     if (!(*buf))
-        *buf = gst_buffer_new_and_alloc(len);
+        *buf = new_buffer = gst_buffer_new_and_alloc(len);
     gst_buffer_map(*buf, &info, GST_MAP_WRITE);
     hr = IMFByteStream_Read(byte_stream, info.data, len, &bytes_read);
     gst_buffer_unmap(*buf, &info);
@@ -468,7 +469,11 @@ GstFlowReturn bytestream_wrapper_pull(GstPad *pad, GstObject *parent, guint64 of
     gst_buffer_set_size(*buf, bytes_read);
 
     if (FAILED(hr))
+    {
+        if (new_buffer)
+            gst_buffer_unref(new_buffer);
         return GST_FLOW_ERROR;
+    }
     return GST_FLOW_OK;
 }
 




More information about the wine-cvs mailing list