plug qtdemux refcount leaks
authorAndy Wingo <wingo@oblong.com>
Tue, 15 Feb 2011 15:30:20 +0000 (16:30 +0100)
committerAndy Wingo <wingo@oblong.com>
Tue, 15 Feb 2011 15:30:29 +0000 (16:30 +0100)
* gst/qtdemux/qtdemux.c (gst_qtdemux_src_convert): Unref the qtdemux; we
  weren't doing so before.
  (gst_qtdemux_handle_src_event, gst_qtdemux_chain): Fix some error
  cases which would leak a ref to the qtdemux.

gst/qtdemux/qtdemux.c

index 587eb61..ceafefa 100644 (file)
@@ -580,8 +580,10 @@ gst_qtdemux_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
   GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad));
   gint32 index;
 
-  if (stream->subtype != FOURCC_vide)
-    return FALSE;
+  if (stream->subtype != FOURCC_vide) {
+    res = FALSE;
+    goto done;
+  }
 
   switch (src_format) {
     case GST_FORMAT_TIME:
@@ -630,6 +632,9 @@ gst_qtdemux_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
       res = FALSE;
   }
 
+done:
+  gst_object_unref (qtdemux);
+
   return res;
 }
 #endif
@@ -1492,6 +1497,7 @@ gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event)
 
   gst_object_unref (qtdemux);
 
+done:
   return res;
 
   /* ERRORS */
@@ -1499,7 +1505,8 @@ index_failed:
   {
     GST_ERROR_OBJECT (qtdemux, "Index failed");
     gst_event_unref (event);
-    return FALSE;
+    res = FALSE;
+    goto done;
   }
 }
 
@@ -4102,8 +4109,10 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf)
           if (demux->got_moov && demux->fragmented) {
             GST_DEBUG_OBJECT (demux, "Parsing [moof]");
             if (!qtdemux_parse_moof (demux, data, demux->neededbytes,
-                    demux->offset, NULL))
-              return GST_FLOW_ERROR;
+                    demux->offset, NULL)) {
+              ret = GST_FLOW_ERROR;
+              goto done;
+            }
           } else {
             GST_DEBUG_OBJECT (demux, "Discarding [moof]");
           }