From: Richard Mudgett Date: Mon, 11 Jul 2016 18:42:55 +0000 (-0500) Subject: ast_expr2: Fix off-nominal memory leak. X-Git-Tag: 11.24.0-rc1~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bc1206299e0be15aedd38f50421b439dc1f14f4;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 781abd95a9..a3c715ac1c 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -3672,6 +3672,8 @@ op_tildetilde (struct val *a, struct val *b) 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 913bc2662e..4f60877733 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -1665,6 +1665,8 @@ op_tildetilde (struct val *a, struct val *b) 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; }