diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-10-12 11:21:39 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-10-12 15:11:39 -0500 |
commit | 984f100dab92fe4051148498e5fab917fe5f4f40 (patch) | |
tree | c00b5d0169a3262aa037855a00d22289ed420a19 /main/config.c | |
parent | 9951255775a28e28632c1ec7f4b24e021d3b59c6 (diff) |
config.c: Fix off-nominal memory leak.
Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
Diffstat (limited to 'main/config.c')
-rw-r--r-- | main/config.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c index 25bc013dd..98fa9a292 100644 --- a/main/config.c +++ b/main/config.c @@ -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 (c) { if (!(cur = strchr(c, ')'))) { + ast_category_destroy(newcat); ast_log(LOG_WARNING, "parse error: no closing ')', line %d of %s\n", lineno, configfile); 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"); 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); return -1; } if (ast_category_inherit(*cat, base)) { + if (newcat) { + ast_category_destroy(newcat); + } ast_log(LOG_ERROR, "Inheritence requested, but allocation failed\n"); return -1; } |