[evolution-rss] do not pass empty string to strcasecmp also free xml property to avoid leaks



commit 8a7cd5437b0ec93e07d1d40ec6fedd2b67455960
Author: Lucian Langa <lucilanga gnome org>
Date:   Tue Jan 18 17:59:07 2011 +0200

    do not pass empty string to strcasecmp
    also free xml property to avoid leaks

 src/parser.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/parser.c b/src/parser.c
index 90c3827..4a40703 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -691,10 +691,15 @@ layer_query_find_prop (xmlNodePtr node,
 {
 	node = node->children;
 	while (node!=NULL) {
-		if (!g_ascii_strcasecmp((gchar *)node->name, match)
-		&& (!g_ascii_strcasecmp((gchar *)xmlGetProp(node, attr), attrprop)
-		   || !xmlGetProp(node, attr)))
-					return (gchar *)xmlGetProp(node, prop);
+		if (!g_ascii_strcasecmp((gchar *)node->name, match)) {
+			gchar *tprop = (gchar *)xmlGetProp(node, attr);
+			if (tprop) {
+				 if (g_ascii_strcasecmp(tprop, attrprop))
+					break;
+			}
+			xmlFree(tprop);
+			return (gchar *)xmlGetProp(node, prop);
+		}
 		node = node->next;
 	}
 	return NULL;



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