ext/ogg/gstoggdemux.c: The chain should be freed if we error out here, else it will...
authorEdward Hervey <bilboed@bilboed.com>
Sat, 23 Jun 2007 14:44:07 +0000 (14:44 +0000)
committerEdward Hervey <bilboed@bilboed.com>
Sat, 23 Jun 2007 14:44:07 +0000 (14:44 +0000)
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_find_chains):
The chain should be freed if we error out here, else it will leak.
* gst/playback/gstdecodebin.c: (disconnect_unlinked_signals),
(cleanup_decodebin):
Don't forget to *properly* remove the signals, else it will leak.

ChangeLog
ext/ogg/gstoggdemux.c
gst/playback/gstdecodebin.c

index 0244abc..6b5c439 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-06-23  Edward Hervey  <edward@fluendo.com>
+
+       * ext/ogg/gstoggdemux.c: (gst_ogg_demux_find_chains):
+       The chain should be freed if we error out here, else it will leak.
+       * gst/playback/gstdecodebin.c: (disconnect_unlinked_signals),
+       (cleanup_decodebin):
+       Don't forget to *properly* remove the signals, else it will leak.
+
 2007-06-22  Jan Schmidt  <thaytan@noraisin.net>
 
        * MAINTAINERS:
index b8b5ada..d3b0b89 100644 (file)
@@ -2712,6 +2712,8 @@ no_first_chain:
 no_last_page:
   {
     GST_DEBUG_OBJECT (ogg, "can't get last page");
+    if (chain)
+      gst_ogg_chain_free (chain);
     return ret;
   }
 }
index 21d6fb4..c3ee826 100644 (file)
@@ -1576,6 +1576,34 @@ shutting_down:
 }
 
 static void
+disconnect_unlinked_signals (GstDecodeBin * decode_bin, GstElement * element)
+{
+  GstIterator *pad_it = NULL;
+  gboolean done = FALSE;
+
+  pad_it = gst_element_iterate_src_pads (element);
+  while (!done) {
+    GstPad *pad = NULL;
+
+    switch (gst_iterator_next (pad_it, (gpointer) & pad)) {
+      case GST_ITERATOR_OK:
+        g_signal_handlers_disconnect_by_func (pad, (gpointer) unlinked,
+            decode_bin);
+        gst_object_unref (pad);
+        break;
+      case GST_ITERATOR_RESYNC:
+        gst_iterator_resync (pad_it);
+        break;
+      default:
+        done = TRUE;
+        break;
+    }
+  }
+  gst_iterator_free (pad_it);
+}
+
+
+static void
 cleanup_decodebin (GstDecodeBin * decode_bin)
 {
   GstIterator *elem_it = NULL, *gpad_it = NULL;
@@ -1600,8 +1628,7 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
       case GST_ITERATOR_OK:
         if (element != decode_bin->typefind && element != decode_bin->fakesink) {
           GST_DEBUG_OBJECT (element, "removing autoplugged element");
-          g_signal_handlers_disconnect_by_func (element, (gpointer) unlinked,
-              decode_bin);
+          disconnect_unlinked_signals (decode_bin, element);
           gst_element_set_state (element, GST_STATE_NULL);
           gst_bin_remove (GST_BIN (decode_bin), element);
         }
@@ -1651,6 +1678,8 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
   if (GST_IS_PAD (typefind_pad)) {
     g_signal_handlers_unblock_by_func (typefind_pad, (gpointer) unlinked,
         decode_bin);
+    g_signal_handlers_disconnect_by_func (typefind_pad, (gpointer) unlinked,
+        decode_bin);
     gst_object_unref (typefind_pad);
   }
 }