gst/playback/: Fix memleaks (#157233).
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Thu, 16 Dec 2004 11:54:53 +0000 (11:54 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Thu, 16 Dec 2004 11:54:53 +0000 (11:54 +0000)
Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* gst/playback/gstdecodebin.c: (new_pad), (close_link):
* gst/playback/gstplaybasebin.c: (new_decoded_pad):
Fix memleaks (#157233).

ChangeLog
gst/playback/gstdecodebin.c
gst/playback/gstplaybasebin.c

index a5a0980..5ce0c00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-16  Christophe Fergeau  <teuf@gnome.org>
+
+       Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * gst/playback/gstdecodebin.c: (new_pad), (close_link):
+       * gst/playback/gstplaybasebin.c: (new_decoded_pad):
+         Fix memleaks (#157233).
+
 2004-12-16  Sebastien Cote  <sc5@hermes.usherb.ca>
 
        Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
index f9a3ba5..4b8f224 100644 (file)
@@ -637,11 +637,15 @@ static void
 new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic)
 {
   GstDecodeBin *decode_bin = dynamic->decode_bin;
+  GstCaps *caps;
 
   /* see if any more pending dynamic connections exist */
   gboolean more = gst_decode_bin_is_dynamic (decode_bin);
 
-  close_pad_link (element, pad, gst_pad_get_caps (pad), decode_bin, more);
+  caps = gst_pad_get_caps (pad);
+  close_pad_link (element, pad, caps, decode_bin, more);
+  if (caps)
+    gst_caps_free (caps);
 }
 
 /* this signal is fired when an element signals the no_more_pads signal.
@@ -813,6 +817,7 @@ close_link (GstElement * element, GstDecodeBin * decode_bin)
   /* now loop over all the pads we need to connect */
   for (pads = to_connect; pads; pads = g_list_next (pads)) {
     GstPad *pad = GST_PAD (pads->data);
+    GstCaps *caps;
 
     /* we have more pads if we have more than 1 pad to connect or
      * dynamics. If we have only 1 pad and no dynamics, more will be
@@ -824,7 +829,10 @@ close_link (GstElement * element, GstDecodeBin * decode_bin)
         gst_pad_get_name (pad));
 
     /* continue autoplugging on the pads */
-    close_pad_link (element, pad, gst_pad_get_caps (pad), decode_bin, more);
+    caps = gst_pad_get_caps (pad);
+    close_pad_link (element, pad, caps, decode_bin, more);
+    if (caps)
+      gst_caps_free (caps);
   }
 
   g_list_free (to_connect);
index f22f1b2..c412eb5 100644 (file)
@@ -657,6 +657,8 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
   caps = gst_pad_get_caps (pad);
   if (caps == NULL || gst_caps_is_empty (caps)) {
     g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
+    if (caps)
+      gst_caps_free (caps);
     return;
   }
 
@@ -717,6 +719,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
   }
   /* add the stream to the list */
   info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL, caps);
+  gst_caps_free (caps);
   info->origin = GST_OBJECT (pad);
   add_stream (group, info);