gst/gstregistryxml.c: Cleanups.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 16 Dec 2005 19:24:24 +0000 (19:24 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 16 Dec 2005 19:24:24 +0000 (19:24 +0000)
Original commit message from CVS:
* gst/gstregistryxml.c: (load_feature):
Cleanups.
Don't use g_object_unref on GstObjects so that we avoid
leaks on unsafe glibs.

ChangeLog
gst/gstregistryxml.c

index d7d8302c85e8aae103b477600a1f7a121f899fe4..8b0ce1d6d1c674d95c61c629b001fbcc5d991859 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-12-16  Wim Taymans  <wim@fluendo.com>
+
+       * gst/gstregistryxml.c: (load_feature):
+       Cleanups.
+       Don't use g_object_unref on GstObjects so that we avoid
+       leaks on unsafe glibs.
+
 2005-12-16  Wim Taymans  <wim@fluendo.com>
 
        * gst/gstbin.c: (gst_bin_recalc_state):
index 3d82423feceff45fdeef53e499d64c5f8cb23a28..43d5ecf52a10891992ba73d7d84795e30530ffcb 100644 (file)
@@ -218,16 +218,20 @@ static GstPluginFeature *
 load_feature (xmlTextReaderPtr reader)
 {
   int ret;
-  int depth = xmlTextReaderDepth (reader);
-  gchar *feature_name =
-      (gchar *) xmlTextReaderGetAttribute (reader, BAD_CAST "typename");
+  int depth;
+  gchar *feature_name;
   GstPluginFeature *feature;
   GType type;
 
+  depth = xmlTextReaderDepth (reader);
+  feature_name =
+      (gchar *) xmlTextReaderGetAttribute (reader, BAD_CAST "typename");
+
   GST_DEBUG ("loading feature");
 
   if (!feature_name)
     return NULL;
+
   type = g_type_from_name (feature_name);
   g_free (feature_name);
   feature_name = NULL;
@@ -240,7 +244,11 @@ load_feature (xmlTextReaderPtr reader)
     return NULL;
   }
   if (!GST_IS_PLUGIN_FEATURE (feature)) {
-    g_object_unref (feature);
+    /* don't really know what it is */
+    if (GST_IS_OBJECT (feature))
+      gst_object_unref (feature);
+    else
+      g_object_unref (feature);
     return NULL;
   }
   while ((ret = xmlTextReaderRead (reader)) == 1) {