[asterisk-commits] ast expr2: Fix off-nominal memory leak. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 11 15:56:28 CDT 2016


Joshua Colp has submitted this change and it was merged.

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(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Verified
  Corey Farrell: Looks good to me, but someone else must approve



diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index b914598..215f831 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -3673,6 +3673,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 29fee35..8b32b2b 100644
--- a/main/ast_expr2.y
+++ b/main/ast_expr2.y
@@ -1666,6 +1666,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/3168
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list