From 864ba94a88fb5a0a9a51907183b304ebe184065e Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 3 Nov 2013 11:23:53 +0100 Subject: [PATCH] Fix potential memleak. --- compat/rxml/rxml.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compat/rxml/rxml.c b/compat/rxml/rxml.c index 9f48fbdcbc..c98597f696 100644 --- a/compat/rxml/rxml.c +++ b/compat/rxml/rxml.c @@ -129,6 +129,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str) struct rxml_attrib_node *list = NULL; struct rxml_attrib_node *tail = NULL; + char *attrib = NULL; + char *value = NULL; char *save; const char *elem = strtok_r(copy, " \n\t\f\v\r", &save); while (elem) @@ -152,6 +154,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str) new_node->attrib = attrib; new_node->value = value; + attrib = NULL; + value = NULL; if (tail) { @@ -166,6 +170,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str) end: free(copy); + free(attrib); + free(value); return list; }