From 6003391d261ef7940bbc14683f60b242fe347adb Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Tue, 14 Mar 2006 18:36:12 +0000 Subject: [PATCH] Fix memory leaks. Fixes bug #333945 2006-03-14 Carlos Garcia Campos * shell/ev-metadata-manager.c (parseItem): Fix memory leaks. Fixes bug #333945 --- ChangeLog | 6 ++++++ shell/ev-metadata-manager.c | 25 +++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd19ccb5..9bff8231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-14 Carlos Garcia Campos + + * shell/ev-metadata-manager.c (parseItem): + + Fix memory leaks. Fixes bug #333945 + 2006-03-13 Nickolay V. Shmyrev * NEWS, configure.ac, TODO: diff --git a/shell/ev-metadata-manager.c b/shell/ev-metadata-manager.c index 4103a351..f5ab0407 100644 --- a/shell/ev-metadata-manager.c +++ b/shell/ev-metadata-manager.c @@ -127,6 +127,15 @@ ev_metadata_manager_shutdown (void) ev_metadata_manager = NULL; } +static void +value_free (gpointer data) +{ + GValue *value = (GValue *)data; + + g_value_unset (value); + g_free (value); +} + static GValue * parse_value (xmlChar *value, xmlChar *type) { @@ -184,7 +193,7 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) item->values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, - g_free); + value_free); cur = cur->xmlChildrenNode; @@ -195,7 +204,7 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) xmlChar *key; xmlChar *xml_value; xmlChar *type; - GValue *value; + GValue *value; key = xmlGetProp (cur, (const xmlChar *)"key"); xml_value = xmlGetProp (cur, (const xmlChar *)"value"); @@ -209,6 +218,8 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) if (key != NULL) xmlFree (key); + if (type != NULL) + xmlFree (type); if (xml_value != NULL) xmlFree (xml_value); } @@ -286,16 +297,6 @@ load_values () return TRUE; } -static void -value_free (gpointer data) -{ - GValue *value = (GValue *)data; - - g_value_unset (value); - g_free (value); -} - - #define LAST_URI "last-used-value" static gboolean -- 2.43.5