diff options
author | Kevin Harwell <kharwell@digium.com> | 2013-08-30 17:59:06 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2013-08-30 17:59:06 +0000 |
commit | af1747ee6c23359e9ac9b88d7821a1985899de60 (patch) | |
tree | 83bce3f9ea8f1ba8746d418f5503d9d4c3959f11 /main | |
parent | 9f1379686f3cf2df9c73aa32dcf37bba520bd75a (diff) |
Memory leak fix
ast_xmldoc_printable returns an allocated block that must be freed by the
caller. Fixed manager.c and res_agi.c to stop leaking these results.
(closes issue ASTERISK-22395)
Reported by: Corey Farrell
Patches:
manager-leaks-12.patch uploaded by coreyfarrell (license 5909)
res_agi-xmldoc-leaks.patch uploaded by coreyfarrell (license 5909)
........
Merged revisions 398060 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 398061 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 398062 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/manager.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/main/manager.c b/main/manager.c index 38c7d8ef9..c8b0e4708 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1924,19 +1924,19 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ #ifdef AST_XML_DOCS if (cur->docsrc == AST_XML_DOC) { + char *syntax = ast_xmldoc_printable(S_OR(cur->syntax, "Not available"), 1); + char *synopsis = ast_xmldoc_printable(S_OR(cur->synopsis, "Not available"), 1); + char *description = ast_xmldoc_printable(S_OR(cur->description, "Not available"), 1); + char *arguments = ast_xmldoc_printable(S_OR(cur->arguments, "Not available"), 1); + char *seealso = ast_xmldoc_printable(S_OR(cur->seealso, "Not available"), 1); + char *privilege = ast_xmldoc_printable(S_OR(authority->str, "Not available"), 1); ast_cli(a->fd, "%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n", - syntax_title, - ast_xmldoc_printable(S_OR(cur->syntax, "Not available"), 1), - synopsis_title, - ast_xmldoc_printable(S_OR(cur->synopsis, "Not available"), 1), - description_title, - ast_xmldoc_printable(S_OR(cur->description, "Not available"), 1), - arguments_title, - ast_xmldoc_printable(S_OR(cur->arguments, "Not available"), 1), - seealso_title, - ast_xmldoc_printable(S_OR(cur->seealso, "Not available"), 1), - privilege_title, - ast_xmldoc_printable(S_OR(authority->str, "Not available"), 1)); + syntax_title, syntax, + synopsis_title, synopsis, + description_title, description, + arguments_title, arguments, + seealso_title, seealso, + privilege_title, privilege); } else #endif { @@ -7560,29 +7560,29 @@ static char *handle_manager_show_event(struct ast_cli_entry *e, int cmd, struct ast_cli(a->fd, "Event: %s\n", a->argv[3]); for (temp = item; temp; temp = temp->next) { if (!ast_strlen_zero(ast_str_buffer(temp->synopsis))) { - ast_cli(a->fd, "%s%s\n\n", - synopsis_title, - ast_xmldoc_printable(ast_str_buffer(temp->synopsis), 1)); + char *synopsis = ast_xmldoc_printable(ast_str_buffer(temp->synopsis), 1); + ast_cli(a->fd, "%s%s\n\n", synopsis_title, synopsis); + ast_free(synopsis); } if (!ast_strlen_zero(ast_str_buffer(temp->syntax))) { - ast_cli(a->fd, "%s%s\n\n", - syntax_title, - ast_xmldoc_printable(ast_str_buffer(temp->syntax), 1)); + char *syntax = ast_xmldoc_printable(ast_str_buffer(temp->syntax), 1); + ast_cli(a->fd, "%s%s\n\n", syntax_title, syntax); + ast_free(syntax); } if (!ast_strlen_zero(ast_str_buffer(temp->description))) { - ast_cli(a->fd, "%s%s\n\n", - description_title, - ast_xmldoc_printable(ast_str_buffer(temp->description), 1)); + char *description = ast_xmldoc_printable(ast_str_buffer(temp->description), 1); + ast_cli(a->fd, "%s%s\n\n", description_title, description); + ast_free(description); } if (!ast_strlen_zero(ast_str_buffer(temp->arguments))) { - ast_cli(a->fd, "%s%s\n\n", - arguments_title, - ast_xmldoc_printable(ast_str_buffer(temp->arguments), 1)); + char *arguments = ast_xmldoc_printable(ast_str_buffer(temp->arguments), 1); + ast_cli(a->fd, "%s%s\n\n", arguments_title, arguments); + ast_free(arguments); } if (!ast_strlen_zero(ast_str_buffer(temp->seealso))) { - ast_cli(a->fd, "%s%s\n\n", - seealso_title, - ast_xmldoc_printable(ast_str_buffer(temp->seealso), 1)); + char *seealso = ast_xmldoc_printable(ast_str_buffer(temp->seealso), 1); + ast_cli(a->fd, "%s%s\n\n", seealso_title, seealso); + ast_free(seealso); } } |