[evolution-patches] [PATCH] leak fix(es) in e-xml-hash-utils



Hi,

Here's a patch to fix a few leaks in e-xml-hash-utils. This was
previously reported on bugzilla as
http://bugzilla.ximian.com/show_bug.cgi?id=53000


Index: libedataserver/e-xml-hash-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-xml-hash-utils.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-xml-hash-utils.c
--- libedataserver/e-xml-hash-utils.c	3 Nov 2003 18:23:56 -0000	1.1.1.1
+++ libedataserver/e-xml-hash-utils.c	17 Jan 2004 19:22:23 -0000
@@ -49,13 +49,20 @@
 		else
 			key = node->name;
 
+		if (!key) {
+			g_warning ("Cannot find key for entry!!");
+			continue;
+		}
+
 		value = xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
-		if (!key || !value) {
+		if (!value) {
+			xmlFree (key);
 			g_warning ("Found an entry with missing properties!!");
 			continue;
 		}
 
 		g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
+		xmlFree (key);
 		xmlFree (value);
 	}
 


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