]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
committing many nice little memleaks fixes from Iain, great work dude
authorChristian Schaller <uraeus@gnome.org>
Sun, 8 Sep 2002 18:27:36 +0000 (18:27 +0000)
committerChristian Schaller <uraeus@gnome.org>
Sun, 8 Sep 2002 18:27:36 +0000 (18:27 +0000)
Original commit message from CVS:
committing many nice little memleaks fixes from Iain, great work dude

13 files changed:
docs/random/wtay/registry
examples/pingpong/pingpong.c
gst/autoplug/gstspideridentity.c
gst/autoplug/gststaticautoplug.c
gst/elements/gstaggregator.c
gst/elements/gstfakesink.c
gst/elements/gstidentity.c
gst/gstelement.c
gst/gstpad.c
plugins/elements/gstaggregator.c
plugins/elements/gstfakesink.c
plugins/elements/gstidentity.c
tests/old/examples/pingpong/pingpong.c

index 2693d2aaa6c68017bc4f9a77c3902d28fac0c67e..49b820081eebd04a3470f47d895bfd0a6134dbf0 100644 (file)
@@ -17,8 +17,9 @@ Requirements
 
 user/system registry
 --------------------
-
-first query the user registry, then fall back to system registry.
+There are two be two registries on the system. One system registry and one user registry.
+The user registry should be queried first, then if that doesn't exist or don't contain any 
+plugins able to handle the mediatype it should fall back to system registry.
 
 model:
 ------
index 28e5cc6d3172bef74b9d5910f2c83010c731d755..9dbbc2f1d514771bcfbf7c996bc597184fbc40fe 100644 (file)
@@ -24,9 +24,15 @@ make_bin (gint count)
 {
   GstElement *bin;
   GstElement *src;
+  char *name;
 
-  bin = gst_bin_new (g_strdup_printf ("bin%d", count));
-  src = gst_element_factory_make ("fakesrc", g_strdup_printf ("fakesrc%d", count));
+  name = g_strdup_printf ("bin%d", count);
+  bin = gst_bin_new (name);
+  g_free (name);
+
+  name = g_strdup_printf ("fakesrc%d", count);
+  src = gst_element_factory_make ("fakesrc", name);
+  g_free (name);
 
   gst_bin_add (GST_BIN (bin), src);
 
index 80e52cb8412eccb58382ab80fe97151ea712bc06..950a01aef7e84eadf3a0238bdd7f8ec6625c2fae 100644 (file)
@@ -362,6 +362,7 @@ static void
 gst_spider_identity_start_type_finding (GstSpiderIdentity *ident)
 {
   GstElement* typefind;
+  gchar *name;
   gboolean restart = FALSE;
   
   GST_DEBUG (GST_CAT_AUTOPLUG, "element %s starts typefinding", GST_ELEMENT_NAME(ident));
@@ -372,7 +373,10 @@ gst_spider_identity_start_type_finding (GstSpiderIdentity *ident)
   }
   
   /* create and connect typefind object */
-  typefind = gst_element_factory_make ("typefind", g_strdup_printf("%s%s", "typefind", GST_ELEMENT_NAME(ident)));
+  name = g_strdup_printf ("%s%s", "typefind", GST_ELEMENT_NAME(ident));
+  typefind = gst_element_factory_make ("typefind", name);
+  g_free (name);
+  
   g_signal_connect (G_OBJECT (typefind), "have_type",
                     G_CALLBACK (callback_type_find_have_type), ident);
   gst_bin_add (GST_BIN (GST_ELEMENT_PARENT (ident)), typefind);
index 9fb3d3c87f233ec122047df08582689a12e0b732..f6911531cba8f31a0a622e9369d5cb097d08b8db 100644 (file)
@@ -201,7 +201,12 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
     pads = g_list_next (pads);
 
     if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), info->endcap)) {
-      gst_element_add_ghost_pad (info->result, pad, g_strdup_printf("src_%02d", info->i));
+      gchar *name;
+
+      name = g_strdup_printf ("src_%02d", info->i);
+      gst_element_add_ghost_pad (info->result, pad, name);
+      g_free (name);
+      
       GST_DEBUG (0,"gstpipeline: new dynamic pad %s", GST_PAD_NAME (pad));
       break;
     }
@@ -460,7 +465,12 @@ differ:
        pads = g_list_next (pads);
 
        if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), endcap)) {
-          gst_element_add_ghost_pad (result, pad, g_strdup_printf("src_%02d", i));
+         gchar *name;
+
+         name = g_strdup_printf ("src_%02d", i);
+          gst_element_add_ghost_pad (result, pad, name);
+         g_free (name);
+         
          have_pad = TRUE;
          break;
        }
index 07aaafb86e2ca8b6b7af35139d61f123f6121a38..a9dbe8732ef20c4be6da1873975a15f69775e5b4 100644 (file)
@@ -174,6 +174,8 @@ gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, cons
   name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
   
   sinkpad = gst_pad_new_from_template (templ, name);
+  g_free (name);
+  
   gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
   gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
   
index a97c6a3f8764f917dbcea99999a505e292e9f95f..44329a0593ce8a0c1b0f6bfcabcc2e4c796a1e0c 100644 (file)
@@ -182,6 +182,8 @@ gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
   name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
 
   sinkpad = gst_pad_new_from_template (templ, name);
+  g_free (name);
+  
   gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
 
   return sinkpad;
index 24426faf3f9a0b9f6ee581ac2f0d54befd350129..be94816e160bfd327f9c57f73b21665fafecc702 100644 (file)
@@ -193,6 +193,7 @@ gst_identity_init (GstIdentity *identity)
   identity->drop_probability = 0.0;
   identity->silent = FALSE;
   identity->dump = FALSE;
+  identity->last_message = NULL;
 }
 
 static void 
@@ -218,6 +219,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
 
   if (identity->drop_probability > 0.0) {
     if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
+      if (identity->last_message != NULL) {
+       g_free (identity->last_message);
+      }
       identity->last_message = g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, %llu)",
              GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
       g_object_notify (G_OBJECT (identity), "last-message");
@@ -231,6 +235,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
 
   for (i = identity->duplicate; i; i--) {
     if (!identity->silent)
+      if (identity->last_message != NULL) {
+       g_free (identity->last_message);
+      }
       identity->last_message = g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, %llu)",
              GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
     g_object_notify (G_OBJECT (identity), "last-message");
index ca4aaebe30a22dcfc6be1754448a9c4511aaa500..bae0ebc780bf3f161d6f79096e6b60afefbff690 100644 (file)
@@ -2339,6 +2339,7 @@ gst_element_save_thyself (GstObject *object,
     spec = specs[i];
     if (spec->flags & G_PARAM_READABLE) {
       xmlNodePtr param;
+      char *contents;
       
       g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (spec));
       
@@ -2347,15 +2348,16 @@ gst_element_save_thyself (GstObject *object,
       xmlNewChild (param, NULL, "name", spec->name);
       
       if (G_IS_PARAM_SPEC_STRING (spec))
-        xmlNewChild (param, NULL, "value", g_value_dup_string (&value));
+       contents = g_value_dup_string (&value);
       else if (G_IS_PARAM_SPEC_ENUM (spec))
-        xmlNewChild (param, NULL, "value", 
-                    g_strdup_printf ("%d", g_value_get_enum (&value)));
+       contents = g_strdup_printf ("%d", g_value_get_enum (&value));
       else if (G_IS_PARAM_SPEC_INT64 (spec))
-        xmlNewChild (param, NULL, "value", 
-                    g_strdup_printf ("%lld", g_value_get_int64 (&value)));
+       contents = g_strdup_printf ("%lld", g_value_get_int64 (&value));
       else
-        xmlNewChild (param, NULL, "value", g_strdup_value_contents (&value));
+       contents = g_strdup_value_contents (&value);
+      
+      xmlNewChild (param, NULL, "value", contents);
+      g_free (contents);
       
       g_value_unset(&value);
     }
@@ -2556,7 +2558,8 @@ gst_element_state_get_name (GstElementState state)
     case GST_STATE_READY: return "\033[01;31mREADY\033[00m";break;
     case GST_STATE_PLAYING: return "\033[01;32mPLAYING\033[00m";break;
     case GST_STATE_PAUSED: return "\033[01;33mPAUSED\033[00m";break;
-    default: 
+    default:
+      /* This is a memory leak */
       return g_strdup_printf ("\033[01;37;41mUNKNOWN!\033[00m(%d)", state);
 #else
     case GST_STATE_VOID_PENDING: return "NONE_PENDING";break;
index 7c14a107fa8deaef4e20a42d344c30274d5255ae..bc770d063ff692b510d84868e491f32fa43c9ca0 100644 (file)
@@ -2001,13 +2001,16 @@ gst_pad_save_thyself (GstObject *object, xmlNodePtr parent)
 
   xmlNewChild (parent, NULL, "name", GST_PAD_NAME (realpad));
   if (GST_RPAD_PEER (realpad) != NULL) {
+    gchar *content;
+    
     peer = GST_PAD (GST_RPAD_PEER (realpad));
     /* first check to see if the peer's parent's parent is the same */
     /* we just save it off */
-    xmlNewChild (parent, NULL, "peer", 
-                g_strdup_printf ("%s.%s",
-                                  GST_OBJECT_NAME (GST_PAD_PARENT (peer)), 
-                                 GST_PAD_NAME (peer)));
+    content = g_strdup_printf ("%s.%s",
+                              GST_OBJECT_NAME (GST_PAD_PARENT (peer)),
+                              GST_PAD_NAME (peer));
+    xmlNewChild (parent, NULL, "peer", content);
+    g_free (content);
   } else
     xmlNewChild (parent, NULL, "peer", "");
 
index 07aaafb86e2ca8b6b7af35139d61f123f6121a38..a9dbe8732ef20c4be6da1873975a15f69775e5b4 100644 (file)
@@ -174,6 +174,8 @@ gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ, cons
   name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
   
   sinkpad = gst_pad_new_from_template (templ, name);
+  g_free (name);
+  
   gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
   gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
   
index a97c6a3f8764f917dbcea99999a505e292e9f95f..44329a0593ce8a0c1b0f6bfcabcc2e4c796a1e0c 100644 (file)
@@ -182,6 +182,8 @@ gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const
   name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads);
 
   sinkpad = gst_pad_new_from_template (templ, name);
+  g_free (name);
+  
   gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad);
 
   return sinkpad;
index 24426faf3f9a0b9f6ee581ac2f0d54befd350129..be94816e160bfd327f9c57f73b21665fafecc702 100644 (file)
@@ -193,6 +193,7 @@ gst_identity_init (GstIdentity *identity)
   identity->drop_probability = 0.0;
   identity->silent = FALSE;
   identity->dump = FALSE;
+  identity->last_message = NULL;
 }
 
 static void 
@@ -218,6 +219,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
 
   if (identity->drop_probability > 0.0) {
     if ((gfloat)(1.0*rand()/(RAND_MAX)) < identity->drop_probability) {
+      if (identity->last_message != NULL) {
+       g_free (identity->last_message);
+      }
       identity->last_message = g_strdup_printf ("dropping   ******* (%s:%s)i (%d bytes, %llu)",
              GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
       g_object_notify (G_OBJECT (identity), "last-message");
@@ -231,6 +235,9 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
 
   for (i = identity->duplicate; i; i--) {
     if (!identity->silent)
+      if (identity->last_message != NULL) {
+       g_free (identity->last_message);
+      }
       identity->last_message = g_strdup_printf ("chain   ******* (%s:%s)i (%d bytes, %llu)",
              GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
     g_object_notify (G_OBJECT (identity), "last-message");
index 28e5cc6d3172bef74b9d5910f2c83010c731d755..9dbbc2f1d514771bcfbf7c996bc597184fbc40fe 100644 (file)
@@ -24,9 +24,15 @@ make_bin (gint count)
 {
   GstElement *bin;
   GstElement *src;
+  char *name;
 
-  bin = gst_bin_new (g_strdup_printf ("bin%d", count));
-  src = gst_element_factory_make ("fakesrc", g_strdup_printf ("fakesrc%d", count));
+  name = g_strdup_printf ("bin%d", count);
+  bin = gst_bin_new (name);
+  g_free (name);
+
+  name = g_strdup_printf ("fakesrc%d", count);
+  src = gst_element_factory_make ("fakesrc", name);
+  g_free (name);
 
   gst_bin_add (GST_BIN (bin), src);