tsdemux: Avoid unlinkely leaks and segfault
authorThibault Saunier <thibault.saunier@collabora.com>
Fri, 24 Feb 2012 18:26:21 +0000 (15:26 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Fri, 24 Feb 2012 18:28:35 +0000 (15:28 -0300)
gst/mpegtsdemux/tsdemux.c

index 357aafd328b573cdb47a36ebf190bc6356edfacb..5b70c44bbd3f91aef2b69726967f1949c42737d3 100644 (file)
@@ -1270,10 +1270,13 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
     gst_pad_set_query_type_function (pad, gst_ts_demux_srcpad_query_types);
     gst_pad_set_query_function (pad, gst_ts_demux_srcpad_query);
     gst_pad_set_event_function (pad, gst_ts_demux_srcpad_event);
-    gst_caps_unref (caps);
   }
 
-  g_free (name);
+  if (name)
+    g_free (name);
+
+  if (caps)
+    gst_caps_unref (caps);
 
   return pad;
 }