mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
config.c: Fix off-nominal memory leak.
Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
This commit is contained in:
@@ -1679,6 +1679,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
/* If there are options or categories to inherit from, process them now */
|
/* If there are options or categories to inherit from, process them now */
|
||||||
if (c) {
|
if (c) {
|
||||||
if (!(cur = strchr(c, ')'))) {
|
if (!(cur = strchr(c, ')'))) {
|
||||||
|
ast_category_destroy(newcat);
|
||||||
ast_log(LOG_WARNING, "parse error: no closing ')', line %d of %s\n", lineno, configfile);
|
ast_log(LOG_WARNING, "parse error: no closing ')', line %d of %s\n", lineno, configfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1707,10 +1708,16 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
|
|
||||||
base = ast_category_get(cfg, cur, "TEMPLATES=include");
|
base = ast_category_get(cfg, cur, "TEMPLATES=include");
|
||||||
if (!base) {
|
if (!base) {
|
||||||
|
if (newcat) {
|
||||||
|
ast_category_destroy(newcat);
|
||||||
|
}
|
||||||
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
|
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ast_category_inherit(*cat, base)) {
|
if (ast_category_inherit(*cat, base)) {
|
||||||
|
if (newcat) {
|
||||||
|
ast_category_destroy(newcat);
|
||||||
|
}
|
||||||
ast_log(LOG_ERROR, "Inheritence requested, but allocation failed\n");
|
ast_log(LOG_ERROR, "Inheritence requested, but allocation failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user