Various: backport of 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.

This is a backport of the fixes from Asterisk
13.

Review: https://reviewboard.asterisk.org/r/4468/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Scott Griepentrog
2015-03-17 22:28:41 +00:00
parent 4f68f39cde
commit 0326622cc1
3 changed files with 35 additions and 32 deletions

View File

@@ -1974,6 +1974,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 a <para> element. */
if (xmldoc_parse_common_elements(tmp, "", "\n", &ret)) {
@@ -2014,7 +2017,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);