Fix some memleaks:
authorDavid Schleef <ds@schleef.org>
Thu, 5 Feb 2004 02:44:34 +0000 (02:44 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 5 Feb 2004 02:44:34 +0000 (02:44 +0000)
Original commit message from CVS:
Fix some memleaks:
* gst/autoplug/gstspider.c: (gst_spider_request_new_pad),
(gst_spider_plug_from_srcpad):
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_link):

ChangeLog
gst/autoplug/gstspider.c
gst/autoplug/gstspideridentity.c

index ea14e3f..3beb673 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2004-02-04  David Schleef  <ds@schleef.org>
 
+       Fix some memleaks:
+       * gst/autoplug/gstspider.c: (gst_spider_request_new_pad),
+       (gst_spider_plug_from_srcpad):
+       * gst/autoplug/gstspideridentity.c: (gst_spider_identity_link):
+
+2004-02-04  David Schleef  <ds@schleef.org>
+
        * gst/gstelement.c: (gst_element_clear_pad_caps): Make sure we have
        a GstRealPad before accessing its structure members.
 
index b3f9c98..3b12efa 100644 (file)
@@ -211,6 +211,7 @@ gst_spider_request_new_pad (GstElement *element, GstPadTemplate *templ, const gc
   gst_bin_add (GST_BIN (element), GST_ELEMENT (identity));
   
   returnpad = gst_element_add_ghost_pad (element, returnpad, padname);
+  g_free (padname);
   gst_spider_link_new (identity);
   GST_DEBUG ("successuflly created requested pad %s:%s", GST_DEBUG_PAD_NAME (returnpad));
   
@@ -588,6 +589,8 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad)
   gboolean result = TRUE;
   GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (conn->src);
   GstElement *startelement = conn->current;
+  GstCaps *caps1;
+  GstCaps *caps2;
 
   g_assert ((GstElement *) GST_OBJECT_PARENT (srcpad) == conn->current);
   GST_DEBUG ("trying to plug from %s:%s to %s", 
@@ -603,7 +606,11 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad)
   }
       
   /* find a path from src to sink */
-  plugpath = gst_autoplug_sp (gst_pad_get_caps (srcpad), gst_pad_get_caps (conn->src->sink), spider->factories);
+  caps1 = gst_pad_get_caps (srcpad);
+  caps2 = gst_pad_get_caps (conn->src->sink);
+  plugpath = gst_autoplug_sp (caps1, caps2, spider->factories);
+  gst_caps_free (caps1);
+  gst_caps_free (caps2);
   
   /* prints out the path that was found for plugging */
   /* g_print ("found path from %s to %s:\n", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
index 598eb76..e172bbd 100644 (file)
@@ -236,7 +236,7 @@ gst_spider_identity_link (GstPad *pad, const GstCaps *caps)
   if (GST_PAD_PEER (otherpad) == NULL)
     return GST_PAD_LINK_DELAYED;
 
-  return gst_pad_try_set_caps (otherpad, gst_caps_copy (caps));
+  return gst_pad_try_set_caps (otherpad, caps);
 }
 
 static GstCaps*