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

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


Anonymous Coward #1000019 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:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
  Corey Farrell: Looks good to me, but someone else must approve



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/3167
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
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