mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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
This commit is contained in:
@@ -1238,23 +1238,27 @@ void ast_category_rename(struct ast_category *cat, const char *name)
|
||||
ast_copy_string(cat->name, name, sizeof(cat->name));
|
||||
}
|
||||
|
||||
void ast_category_inherit(struct ast_category *new, const struct ast_category *base)
|
||||
int ast_category_inherit(struct ast_category *new, const struct ast_category *base)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_category_template_instance *x;
|
||||
|
||||
x = ast_calloc(1, sizeof(*x));
|
||||
if (!x) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
strcpy(x->name, base->name);
|
||||
x->inst = base;
|
||||
AST_LIST_INSERT_TAIL(&new->template_instances, x, next);
|
||||
for (var = base->root; var; var = var->next) {
|
||||
struct ast_variable *cloned = variable_clone(var);
|
||||
if (!cloned) {
|
||||
return -1;
|
||||
}
|
||||
cloned->inherited = 1;
|
||||
ast_variable_append(new, cloned);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ast_config *ast_config_new(void)
|
||||
@@ -1691,7 +1695,10 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
||||
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
|
||||
return -1;
|
||||
}
|
||||
ast_category_inherit(*cat, base);
|
||||
if (ast_category_inherit(*cat, base)) {
|
||||
ast_log(LOG_ERROR, "Inheritence requested, but allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user