[gnac/devel] Fixed a bug and memory leaks



commit 1c7d99d6826753911504e4b3f261b05ceda5c475
Author: BenoÃt Dupasquier <bdupasqu src gnome org>
Date:   Thu Jan 12 22:27:24 2012 +0000

    Fixed a bug and memory leaks

 src/profiles/gnac-profiles-xml-engine.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/profiles/gnac-profiles-xml-engine.c b/src/profiles/gnac-profiles-xml-engine.c
index fbe9851..44c74e0 100755
--- a/src/profiles/gnac-profiles-xml-engine.c
+++ b/src/profiles/gnac-profiles-xml-engine.c
@@ -125,7 +125,11 @@ gnac_profiles_xml_engine_get_text_node(XMLDoc      *doc,
 
   xmlXPathFreeObject(xpath_obj);
 
-  return gettext((gchar *) xmlNodeGetContent(node->children));
+  xmlChar *content = xmlNodeGetContent(node->children);
+  gchar *translated = g_strdup(gettext((gchar *) content));
+  xmlFree(content);
+
+  return translated;
 }
 
 
@@ -276,8 +280,9 @@ gnac_profiles_xml_engine_get_combo_values(XMLDoc      *doc,
       if (!gnac_profiles_xml_engine_is_i18n_node(current_node)) {
         values = g_list_append(values,
             xmlNodeGetContent(current_node->properties->children));
-        names = g_list_append(names,
-            gettext((gchar *) xmlNodeGetContent(current_node->children)));
+        xmlChar *content = xmlNodeGetContent(current_node->children);
+        names = g_list_append(names, g_strdup(gettext((gchar *) content)));
+        xmlFree(content);
       }
 
       current_node = current_node->next;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]