[0.11] gst-plugins-bad: mpegdemux: avoid some unlikely leaks

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jan 25 04:24:00 PST 2012


Module: gst-plugins-bad
Branch: 0.11
Commit: 552f991ba0710c5cb76c8b8f72cd0c757c52c895
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=552f991ba0710c5cb76c8b8f72cd0c757c52c895

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Mon Jan 23 14:01:02 2012 +0100

mpegdemux: avoid some unlikely leaks

---

 gst/mpegdemux/gstmpegdemux.c   |    9 +++++++--
 gst/mpegdemux/gstmpegtsdemux.c |    7 ++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c
index 7d5b139..d1f58d0 100644
--- a/gst/mpegdemux/gstmpegdemux.c
+++ b/gst/mpegdemux/gstmpegdemux.c
@@ -399,8 +399,13 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
       break;
   }
 
-  if (name == NULL || template == NULL || caps == NULL)
-    return NULL;
+  if (name == NULL || template == NULL || caps == NULL) {
+    if (name)
+      g_free (name);
+    if (caps)
+      gst_caps_unref (caps);
+    return FALSE;
+  }
 
   stream = g_new0 (GstFluPSStream, 1);
   stream->id = id;
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c
index 5ee8dae..7d75bbe 100644
--- a/gst/mpegdemux/gstmpegtsdemux.c
+++ b/gst/mpegdemux/gstmpegtsdemux.c
@@ -829,8 +829,13 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id,
     default:
       break;
   }
-  if (name == NULL || template == NULL || caps == NULL)
+  if (name == NULL || template == NULL || caps == NULL) {
+    if (name)
+      g_free (name);
+    if (caps)
+      gst_caps_unref (caps);
     return FALSE;
+  }
 
   stream->stream_type = stream_type;
   stream->id = id;



More information about the gstreamer-commits mailing list