From c2e64f65dac7f7e686007d949da6bdce17d7ec07 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 15 Sep 2002 13:45:26 +0000 Subject: [PATCH] Small cleanups and leak fixes Original commit message from CVS: Small cleanups and leak fixes --- gst/elements/gstfakesrc.c | 2 ++ gst/gst.c | 4 ++++ gst/gstdata.c | 3 ++- gst/gstelementfactory.c | 2 +- gst/registries/gstxmlregistry.c | 3 +++ plugins/elements/gstfakesrc.c | 2 ++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index 0b759d8c9b..cf8a32d6c6 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -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 (); diff --git a/gst/gst.c b/gst/gst.c index cf1967edb8..146d1776de 100644 --- 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); } } diff --git a/gst/gstdata.c b/gst/gstdata.c index 5e31459235..72d01e8a1b 100644 --- a/gst/gstdata.c +++ b/gst/gstdata.c @@ -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. diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 702ed8edd8..3884049454 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -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); diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 1f7f0e1761..83b79c3e13 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -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; diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 0b759d8c9b..cf8a32d6c6 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -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 ();