diff options
author | Scott Griepentrog <sgriepentrog@digium.com> | 2015-03-17 22:15:42 +0000 |
---|---|---|
committer | Scott Griepentrog <sgriepentrog@digium.com> | 2015-03-17 22:15:42 +0000 |
commit | 8c65c9167ee6fe75c7e7f511d12480831f98dad3 (patch) | |
tree | 5cde1e58b672d19b1ca5cdc2c9ad6f128bddf37b /main/xmldoc.c | |
parent | f25b2653293d0d96479d3d83795f40828f0b7bb7 (diff) |
Various: bugfixes found via chaos
Using DEBUG_CHAOS several instances of a null
pointer crash, and one uninitialized variable
were uncovered and fixed. Also added details
on why Asterisk failed to initialize.
Review: https://reviewboard.asterisk.org/r/4468/
........
Merged revisions 433064 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/xmldoc.c')
-rw-r--r-- | main/xmldoc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/xmldoc.c b/main/xmldoc.c index 2a17e5287..395df8ea0 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -2214,6 +2214,9 @@ static struct ast_str *xmldoc_get_formatted(struct ast_xml_node *node, int raw_o ast_xml_free_text(tmpstr); } else { ret = ast_str_create(128); + if (!ret) { + return NULL; + } for (tmp = ast_xml_node_get_children(node); tmp; tmp = ast_xml_node_get_next(tmp)) { /* if found, parse children elements. */ if (xmldoc_parse_common_elements(tmp, "", "\n", &ret)) { @@ -2263,7 +2266,7 @@ static char *_xmldoc_build_field(struct ast_xml_node *node, const char *var, int } formatted = xmldoc_get_formatted(node, raw, raw); - if (ast_str_strlen(formatted) > 0) { + if (formatted && ast_str_strlen(formatted) > 0) { ret = ast_strdup(ast_str_buffer(formatted)); } ast_free(formatted); |