Small cleanups and leak fixes
authorWim Taymans <wim.taymans@gmail.com>
Sun, 15 Sep 2002 13:45:26 +0000 (13:45 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 15 Sep 2002 13:45:26 +0000 (13:45 +0000)
Original commit message from CVS:
Small cleanups and leak fixes

gst/elements/gstfakesrc.c
gst/gst.c
gst/gstdata.c
gst/gstelementfactory.c
gst/registries/gstxmlregistry.c
plugins/elements/gstfakesrc.c

index 0b759d8..cf8a32d 100644 (file)
@@ -839,6 +839,8 @@ gst_fakesrc_change_state (GstElement *element)
         gst_buffer_pool_unref (fakesrc->pool);
         fakesrc->pool = NULL;
       }
+      if (fakesrc->last_message)
+        g_free (fakesrc->last_message);
       break;
     default:
       g_assert_not_reached ();
index cf1967e..146d177 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -190,8 +190,11 @@ gst_init_with_popt_table (int *argc, char **argv[], const struct poptOption *pop
              poptBadOption (context, 0),
              poptStrerror (nextopt),
              (*argv)[0]);
+
+    poptFreeContext (context);
     exit (1);
   }
+  poptFreeContext (context);
 
   /* let's do this once there are 1.6.3 popt debs out
      *argc = poptStrippedArgv (context, *argc, *argv); */
@@ -600,6 +603,7 @@ gst_main_quit (void)
     GMainLoop *loop = mainloops->data;
     mainloops = g_slist_delete_link (mainloops, mainloops);
     g_main_loop_quit (loop);
+    g_main_loop_unref (loop);
   }
 }
 
index 5e31459..72d01e8 100644 (file)
@@ -99,7 +99,8 @@ gst_data_copy (const GstData *data)
  * Copies the given #GstData if the refcount is greater than 1 so that the
  * #GstData object can be written to safely.
  *
- * Returns: a copy of the data if the refcount is > 1, data if the refcount == 1
+ * Returns: a copy of the data if the refcount is > 1 or the buffer is 
+ * marked READONLY, data if the refcount == 1,
  * or NULL if the data could not be copied. The refcount of the original buffer
  * is decreased when a copy is made, so you are not supposed to use it after a
  * call to this function.
index 702ed8e..3884049 100644 (file)
@@ -144,7 +144,7 @@ gst_element_factory_new (const gchar *name, GType type,
 {
   GstElementFactory *factory;
 
-  g_return_val_if_fail(name != NULL, NULL);
+  g_return_val_if_fail (name != NULL, NULL);
   g_return_val_if_fail (type, NULL);
   g_return_val_if_fail (details, NULL);
 
index 1f7f0e1..83b79c3 100644 (file)
@@ -608,6 +608,7 @@ gst_xml_registry_load (GstRegistry *registry)
   g_timer_stop (timer);
 
   seconds = g_timer_elapsed (timer, NULL);
+  g_timer_destroy (timer);
 
   g_print ("registry: loaded %s in %f seconds\n          (%s)\n", 
           registry->name, seconds, xmlregistry->location);
@@ -1059,6 +1060,8 @@ gst_xml_registry_end_element (GMarkupParseContext *context,
        xmlregistry->parser = gst_xml_registry_parse_padtemplate;
 
        caps = gst_caps_new (xmlregistry->caps_name, xmlregistry->caps_mime, xmlregistry->props);
+       g_free (xmlregistry->caps_mime);
+       g_free (xmlregistry->caps_name);
 
        xmlregistry->caps = gst_caps_append (xmlregistry->caps, caps);
        xmlregistry->props = NULL;
index 0b759d8..cf8a32d 100644 (file)
@@ -839,6 +839,8 @@ gst_fakesrc_change_state (GstElement *element)
         gst_buffer_pool_unref (fakesrc->pool);
         fakesrc->pool = NULL;
       }
+      if (fakesrc->last_message)
+        g_free (fakesrc->last_message);
       break;
     default:
       g_assert_not_reached ();