[asterisk-commits] kmoore: trunk r382587 - /trunk/main/xmldoc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 7 09:36:56 CST 2013


Author: kmoore
Date: Thu Mar  7 09:36:52 2013
New Revision: 382587

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382587
Log:
Fix minor memory leak in xmldoc

Strings retrieved via ast_xml_get_text() must be freed with
ast_xml_free_text().

Modified:
    trunk/main/xmldoc.c

Modified: trunk/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/xmldoc.c?view=diff&rev=382587&r1=382586&r2=382587
==============================================================================
--- trunk/main/xmldoc.c (original)
+++ trunk/main/xmldoc.c Thu Mar  7 09:36:52 2013
@@ -1150,6 +1150,7 @@
 		text = ast_xml_get_text(tmp);
 		ast_str_set(&syntax, 0, "category %s /%s/", match ? "=~" : "!~", text);
 		ast_xml_free_attr(attr_value);
+		ast_xml_free_text(text);
 	}
 
 	if ((tmp = ast_xml_find_element(ast_xml_node_get_children(matchinfo), "field", NULL, NULL))) {
@@ -1157,6 +1158,7 @@
 		attr_value = ast_xml_get_attribute(tmp, "name");
 		ast_str_append(&syntax, 0, " matchfield: %s = %s", S_OR(attr_value, "Unknown"), text);
 		ast_xml_free_attr(attr_value);
+		ast_xml_free_text(text);
 	}
 	return ast_strdup(ast_str_buffer(syntax));
 }




More information about the asterisk-commits mailing list