]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
config.c: Fix off-nominal memory leak. 21/1421/1
authorRichard Mudgett <rmudgett@digium.com>
Mon, 12 Oct 2015 16:21:39 +0000 (11:21 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 12 Oct 2015 19:32:33 +0000 (14:32 -0500)
Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0

main/config.c

index 6edee56164aa1fbe5628789a03c38877e9d172e8..59d5163342d2fa83436a9dbaf61b40b46e1330c2 100644 (file)
@@ -1426,6 +1426,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;
                        }
@@ -1454,6 +1455,9 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
 
                                        base = category_get(cfg, cur, 1);
                                        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;
                                        }