libgda r3046 - in trunk: . libgda



Author: arminb
Date: Sat Jan 26 23:06:23 2008
New Revision: 3046
URL: http://svn.gnome.org/viewvc/libgda?rev=3046&view=rev

Log:
2008-01-26  Armin Burgmeier  <armin openismus com>

	* libgda/gda-server-operation.c:
	(xml_load_file): Don't leak this_lang, ignore entry when id is NULL
	which caused a segfault on Windows.


Modified:
   trunk/ChangeLog
   trunk/libgda/gda-server-operation.c

Modified: trunk/libgda/gda-server-operation.c
==============================================================================
--- trunk/libgda/gda-server-operation.c	(original)
+++ trunk/libgda/gda-server-operation.c	Sat Jan 26 23:06:23 2008
@@ -750,17 +750,25 @@
 
 		/* don't care about entries for the wrong locale */
 		this_lang = xmlGetProp(node, (xmlChar*)"lang");
-		if (this_lang && strncmp ((gchar*)this_lang, lang, strlen ((gchar*)this_lang))) {
-			g_free (this_lang);
+		if (this_lang) {
+			if (strncmp ((gchar*)this_lang, lang, strlen ((gchar*)this_lang))) {
+				xmlFree (this_lang);
+				node = node->next;
+				continue;
+			}
+
+			xmlFree(this_lang);
+		}
+
+		id = xmlGetProp (node, BAD_CAST "id");
+		if (!id) {
 			node = node->next;
 			continue;
 		}
 
-		id = xmlGetProp (node, BAD_CAST "id");
 		complete_path = g_strdup_printf ("%s/%s", root ? root : "", id);
 		path_name = g_strdup ((gchar*)id);
-		if (id)
-			xmlFree (id);
+		xmlFree (id);
 
 		old_opnode = node_find (op, complete_path);
 		if (old_opnode) {



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