diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-01-30 16:49:59 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2015-01-30 16:49:59 +0000 |
commit | bd0bdf1e41c52afb6dbf262d60a8ed02d2110fcd (patch) | |
tree | 8f6b06aedf21985ef4c0b3ca1b21ea7e56319bfa /main/xmldoc.c | |
parent | 388d691f34d7cfcb77130965bf8709eee4b692c1 (diff) |
Fix some memory leaks.
These memory leaks were found and fixed by John Hardin. I'm just
committing them for him.
ASTERISK-24736 #close
Reported by Mark Michelson
Review: https://reviewboard.asterisk.org/r/4389
........
Merged revisions 431468 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/xmldoc.c')
-rw-r--r-- | main/xmldoc.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/main/xmldoc.c b/main/xmldoc.c index 50b6cfe7d..2a17e5287 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -2533,7 +2533,8 @@ static struct ast_xml_doc_item *xmldoc_build_list_responses(struct ast_xml_node /* Iterate over managerEvent nodes */ for (event = ast_xml_node_get_children(list_elements); event; event = ast_xml_node_get_next(event)) { struct ast_xml_node *event_instance; - const char *name = ast_xml_get_attribute(event, "name"); + RAII_VAR(const char *, name, ast_xml_get_attribute(event, "name"), + ast_xml_free_attr); struct ast_xml_doc_item *new_item; if (!name || strcmp(ast_xml_node_get_name(event), "managerEvent")) { @@ -2607,10 +2608,16 @@ static struct ast_xml_doc_item *xmldoc_build_final_response(struct ast_xml_node "managerEventInstance", NULL, NULL); if (!event_instance) { return NULL; + } else { + const char *name; + struct ast_xml_doc_item *res; + + name = ast_xml_get_attribute(final_response_event, "name"); + res = xmldoc_build_documentation_item(event_instance, name, "managerEvent"); + ast_xml_free_attr(name); + return res; } - return xmldoc_build_documentation_item(event_instance, - ast_xml_get_attribute(final_response_event, "name"), "managerEvent"); } struct ast_xml_doc_item *ast_xmldoc_build_final_response(const char *type, const char *name, const char *module) |