fix spider memleaks #137863
authorThomas Vander Stichele <thomas@apestaart.org>
Tue, 6 Jul 2004 12:00:53 +0000 (12:00 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Tue, 6 Jul 2004 12:00:53 +0000 (12:00 +0000)
Original commit message from CVS:
fix spider memleaks #137863

ChangeLog
gst/autoplug/gstspider.c

index 477f843..2c99b15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-07-06  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+       patch by: Sebastien Cote <sc5 at hermes.usherb.ca>
+
+       * gst/autoplug/gstspider.c: (gst_spider_init),
+       (gst_spider_dispose):
+         fix spider memleaks.  fixes #137863
+
+2004-07-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
        patch by: Joe Marcus Clarke <marcus at freebsd dot org>
 
        * gst/schedulers/gstoptimalscheduler.c:
index cc77319..0ceedf8 100644 (file)
@@ -182,8 +182,10 @@ gst_spider_init (GstSpider * spider)
 {
   /* use only elements which have sources and sinks and where the sinks have caps */
   /* FIXME: How do we handle factories that are added after the spider was constructed? */
-  spider->factories = gst_autoplug_factories_filters_with_sink_caps ((GList *)
-      gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY));
+  GList *list = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
+
+  spider->factories = gst_autoplug_factories_filters_with_sink_caps (list);
+  g_list_free (list);
 
   spider->links = NULL;
 
@@ -198,11 +200,21 @@ static void
 gst_spider_dispose (GObject * object)
 {
   GstSpider *spider;
+  GList *list;
 
   spider = GST_SPIDER (object);
   g_list_free (spider->factories);
   spider->factories = NULL;
 
+  for (list = spider->links; list; list = list->next) {
+    GstSpiderConnection *conn = list->data;
+
+    g_list_free (conn->path);
+    g_free (conn);
+  }
+  g_list_free (spider->links);
+  spider->links = NULL;
+
   ((GObjectClass *) parent_class)->dispose (object);
 }
 static GstPad *