From: Matthias Clasen Date: Sun, 30 Sep 2012 18:07:37 +0000 (-0400) Subject: Fix memory leaks in glib-compile resources X-Git-Tag: 2.34.1~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f325939bae0a82f4d0f926f73f1002dbd4a0a11;p=platform%2Fupstream%2Fglib.git Fix memory leaks in glib-compile resources Based on a patch by Josselin Mouette, https://bugzilla.gnome.org/show_bug.cgi?id=685069 --- diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index fbe2c73..c712010 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -269,7 +269,6 @@ end_element (GMarkupParseContext *context, if (state->preproc_options) { gchar **options; - gchar *stderr_child = NULL; guint i; gboolean xml_stripblanks = FALSE; gboolean to_pixdata = FALSE; @@ -296,6 +295,7 @@ end_element (GMarkupParseContext *context, { gchar *argv[8]; int status, fd, argc; + gchar *stderr_child = NULL; tmp_file = g_strdup ("resource-XXXXXXXX"); if ((fd = g_mkstemp (tmp_file)) == -1) @@ -325,6 +325,7 @@ end_element (GMarkupParseContext *context, G_SPAWN_STDOUT_TO_DEV_NULL, NULL, NULL, NULL, &stderr_child, &status, &my_error)) { + g_free (stderr_child); g_propagate_error (error, my_error); goto cleanup; } @@ -334,10 +335,10 @@ end_element (GMarkupParseContext *context, { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error processing input file with xmllint:\n%s"), stderr_child); + g_free (stderr_child); goto cleanup; } - g_free (stderr_child); g_free (real_file); real_file = g_strdup (tmp_file); } @@ -382,6 +383,7 @@ end_element (GMarkupParseContext *context, NULL, NULL, NULL, &stderr_child, &status, &my_error)) { g_propagate_error (error, my_error); + g_free (stderr_child); goto cleanup; } @@ -389,10 +391,10 @@ end_element (GMarkupParseContext *context, { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error processing input file with to-pixdata:\n%s"), stderr_child); + g_free (stderr_child); goto cleanup; } - g_free (stderr_child); g_free (real_file); real_file = g_strdup (tmp_file2); }