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



On Tue, 2004-01-20 at 18:40, Rodrigo Moya wrote:
> looks ok to me, although I'd change:
> with a more meaningful message, like 'Found a key with no value'.

Done.

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	21 Jan 2004 21:57:26 -0000
@@ -49,13 +49,20 @@
 		else
 			key = node->name;
 
+		if (!key) {
+			g_warning ("Found a key with no value!!");
+			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]