mpegdemux: avoid some unlikely leaks
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Mon, 23 Jan 2012 13:01:02 +0000 (14:01 +0100)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Mon, 23 Jan 2012 13:22:17 +0000 (14:22 +0100)
gst/mpegdemux/gstmpegdemux.c
gst/mpegdemux/gstmpegtsdemux.c

index 7d5b139050fd87b74f607d2ede50cf34bb09e63b..d1f58d0796dfa5fd304101c951216e47aa0d1865 100644 (file)
@@ -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;
index 5ee8daeb102a9f0a90ab5e676c0ac3dc248f34bc..7d75bbeb03518485fbded980de3666aadbeb06a8 100644 (file)
@@ -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;