[Asterisk-code-review] config.c: Fix off-nominal memory leak. (asterisk[11])

Richard Mudgett asteriskteam at digium.com
Mon Oct 12 15:14:55 CDT 2015


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/1421

Change subject: config.c: Fix off-nominal memory leak.
......................................................................

config.c: Fix off-nominal memory leak.

Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
---
M main/config.c
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/21/1421/1

diff --git a/main/config.c b/main/config.c
index 6edee56..59d5163 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1426,6 +1426,7 @@
 		/* 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 @@
 
 					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;
 					}

-- 
To view, visit https://gerrit.asterisk.org/1421
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list