summaryrefslogtreecommitdiff
path: root/main/xmldoc.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-03-07 16:21:52 +0000
committerKinsey Moore <kmoore@digium.com>2013-03-07 16:21:52 +0000
commit675f43f24f3639aae3808e734edb553856c14618 (patch)
tree5431a65fe270e35b925be03c1e2a77be1010b6f4 /main/xmldoc.c
parent80b8c2349c427a94a428670f1183bdc693936813 (diff)
Resolve more memory leaks in xmldoc
Many places that allocated to pull out an attribute are now freed properly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/xmldoc.c')
-rw-r--r--main/xmldoc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/main/xmldoc.c b/main/xmldoc.c
index d0f8dbbbf..71def2aa3 100644
--- a/main/xmldoc.c
+++ b/main/xmldoc.c
@@ -760,6 +760,7 @@ static char *xmldoc_get_syntax_fun(struct ast_xml_node *rootnode, const char *ro
if ((paramtype = ast_xml_get_attribute(node, "required"))) {
if (!ast_true(paramtype)) {
optmidnode = 1;
+ ast_xml_free_attr(paramtype);
break;
}
ast_xml_free_attr(paramtype);
@@ -2347,16 +2348,22 @@ static void build_config_docs(struct ast_xml_node *cur, struct ast_xml_doc_item
struct ast_xml_doc_item *item;
for (iter = ast_xml_node_get_children(cur); iter; iter = ast_xml_node_get_next(iter)) {
+ const char *iter_name;
if (strncasecmp(ast_xml_node_get_name(iter), "config", 6)) {
continue;
}
+ iter_name = ast_xml_get_attribute(iter, "name");
/* Now add all of the child config-related items to the list */
- if (!(item = xmldoc_build_documentation_item(iter, ast_xml_get_attribute(iter, "name"), ast_xml_node_get_name(iter)))) {
- ast_log(LOG_ERROR, "Could not build documentation for '%s:%s'\n", ast_xml_node_get_name(iter), ast_xml_get_attribute(iter, "name"));
+ if (!(item = xmldoc_build_documentation_item(iter, iter_name, ast_xml_node_get_name(iter)))) {
+ ast_log(LOG_ERROR, "Could not build documentation for '%s:%s'\n", ast_xml_node_get_name(iter), iter_name);
+ ast_xml_free_attr(iter_name);
break;
}
+ ast_xml_free_attr(iter_name);
if (!strcasecmp(ast_xml_node_get_name(iter), "configOption")) {
- ast_string_field_set(item, ref, ast_xml_get_attribute(cur, "name"));
+ const char *name = ast_xml_get_attribute(cur, "name");
+ ast_string_field_set(item, ref, name);
+ ast_xml_free_attr(name);
}
(*tail)->next = item;
*tail = (*tail)->next;