Fix memory leaks in glib-compile resources

Based on a patch by Josselin Mouette,
https://bugzilla.gnome.org/show_bug.cgi?id=685069
This commit is contained in:
Matthias Clasen 2012-09-30 14:07:37 -04:00
parent 7c045e3423
commit 7f325939ba

View File

@ -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);
}