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

Richard Mudgett asteriskteam at digium.com
Mon Jul 11 13:50:21 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/3166

Change subject: ast_expr2: Fix off-nominal memory leak.
......................................................................

ast_expr2: Fix off-nominal memory leak.

Thanks to ibercom for pointing out a memory leak that was missed
in the earlier patch for the issue.

ASTERISK-26119
Reported by: Alexei Gradinari

Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71
---
M main/ast_expr2.c
M main/ast_expr2.y
2 files changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/66/3166/1

diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index 781abd9..a3c715a 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -3672,6 +3672,8 @@
 	vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
 	if (vs == NULL) {
 		ast_log(LOG_WARNING, "malloc() failed\n");
+		free_value(a);
+		free_value(b);
 		return NULL;
 	}
 
diff --git a/main/ast_expr2.y b/main/ast_expr2.y
index 913bc26..4f60877 100644
--- a/main/ast_expr2.y
+++ b/main/ast_expr2.y
@@ -1665,6 +1665,8 @@
 	vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
 	if (vs == NULL) {
 		ast_log(LOG_WARNING, "malloc() failed\n");
+		free_value(a);
+		free_value(b);
 		return NULL;
 	}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71
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