plug another memleak in registry loading - I have NO idea why this was returning...
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 8 Jul 2005 16:08:16 +0000 (16:08 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 8 Jul 2005 16:08:16 +0000 (16:08 +0000)
Original commit message from CVS:
plug another memleak in registry loading - I have NO idea why this was returning a GstPlugin

ChangeLog
gst/registries/gstlibxmlregistry.c

index 28d50e5..940c17e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-07-08  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+       * gst/registries/gstlibxmlregistry.c: (read_string), (load_paths),
+       (gst_xml_registry_load):
+         plug another memleak
+
+2005-07-08  Thomas Vander Stichele  <thomas at apestaart dot org>
+
        * configure.ac:
          use GST_SET_ERROR_CFLAGS
        * docs/faq/cvs.xml:
index f6dfd56..9a4d5f2 100644 (file)
@@ -573,6 +573,11 @@ add_to_char_array (gchar *** array, gchar * value)
   *array = new;
 }
 
+/* read a string and store the result in *write_to.
+ * return whether or not *write_to was set to a newly allocated string
+ * FIXME: return values aren't actually checked, and in those failure cases
+ * (that currently aren't triggered) cleanup is not done correctly
+ */
 static gboolean
 read_string (xmlTextReaderPtr reader, gchar ** write_to)
 {
@@ -585,12 +590,14 @@ read_string (xmlTextReaderPtr reader, gchar ** write_to)
     if (xmlTextReaderDepth (reader) == depth)
       return found;
     if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_TEXT) {
-      if (found)
+      if (found) {
         return FALSE;
+      }
       *write_to = g_strdup ((gchar *) xmlTextReaderConstValue (reader));
       found = TRUE;
     }
   }
+
   return FALSE;
 }
 
@@ -850,15 +857,14 @@ load_plugin (xmlTextReaderPtr reader)
   return NULL;
 }
 
-static GstPlugin *
+static void
 load_paths (xmlTextReaderPtr reader, GstXMLRegistry * registry)
 {
   int ret;
-  GstPlugin *plugin = g_new0 (GstPlugin, 1);
 
   while ((ret = xmlTextReaderRead (reader)) == 1) {
     if (xmlTextReaderDepth (reader) == 1) {
-      return plugin;
+      return;
     }
     if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_ELEMENT &&
         xmlTextReaderDepth (reader) == 2) {
@@ -876,8 +882,7 @@ load_paths (xmlTextReaderPtr reader, GstXMLRegistry * registry)
     }
   }
 
-  g_free (plugin);
-  return NULL;
+  return;
 }
 
 static gboolean
@@ -925,7 +930,8 @@ gst_xml_registry_load (GstRegistry * registry)
           GstPlugin *plugin = load_plugin (reader);
 
           if (plugin) {
-            GST_DEBUG ("adding plugin %s with %d features", plugin->desc.name,
+            GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING,
+                "adding plugin %s with %d features", plugin->desc.name,
                 plugin->numfeatures);
             gst_registry_add_plugin (GST_REGISTRY (xmlregistry), plugin);
           }