mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 09:58:54 +02:00
glib-compile-resources: Fix minor memory leak on error path
Spotted by Coverity (CID: #1353385).
This commit is contained in:
@@ -216,7 +216,7 @@ end_element (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
gchar *file, *real_file;
|
gchar *file, *real_file;
|
||||||
gchar *key;
|
gchar *key;
|
||||||
FileData *data;
|
FileData *data = NULL;
|
||||||
char *tmp_file = NULL;
|
char *tmp_file = NULL;
|
||||||
char *tmp_file2 = NULL;
|
char *tmp_file2 = NULL;
|
||||||
|
|
||||||
@@ -238,8 +238,6 @@ end_element (GMarkupParseContext *context,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = g_new0 (FileData, 1);
|
|
||||||
|
|
||||||
if (sourcedirs != NULL)
|
if (sourcedirs != NULL)
|
||||||
{
|
{
|
||||||
real_file = find_file (file);
|
real_file = find_file (file);
|
||||||
@@ -263,6 +261,7 @@ end_element (GMarkupParseContext *context,
|
|||||||
real_file = g_strdup (file);
|
real_file = g_strdup (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = g_new0 (FileData, 1);
|
||||||
data->filename = g_strdup (real_file);
|
data->filename = g_strdup (real_file);
|
||||||
if (!state->collect_data)
|
if (!state->collect_data)
|
||||||
goto done;
|
goto done;
|
||||||
@@ -416,6 +415,7 @@ end_element (GMarkupParseContext *context,
|
|||||||
done:
|
done:
|
||||||
|
|
||||||
g_hash_table_insert (state->table, key, data);
|
g_hash_table_insert (state->table, key, data);
|
||||||
|
data = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
@@ -440,6 +440,9 @@ end_element (GMarkupParseContext *context,
|
|||||||
unlink (tmp_file2);
|
unlink (tmp_file2);
|
||||||
g_free (tmp_file2);
|
g_free (tmp_file2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data != NULL)
|
||||||
|
file_data_free (data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user