From 5134a8043a81b5b3d0b70ae3fbf7564f2526469a Mon Sep 17 00:00:00 2001 From: Alexei Gradinari Date: Thu, 16 Jun 2016 16:56:19 -0400 Subject: fix: memory leaks, resource leaks, out of bounds and bugs ASTERISK-26119 #close Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c --- main/ast_expr2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'main/ast_expr2.c') diff --git a/main/ast_expr2.c b/main/ast_expr2.c index a9e4eff44..781abd95a 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -3668,13 +3668,20 @@ op_tildetilde (struct val *a, struct val *b) /* strip double quotes from both -- */ strip_quotes(a); strip_quotes(b); - + vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1); + if (vs == NULL) { + ast_log(LOG_WARNING, "malloc() failed\n"); + return NULL; + } + strcpy(vs,a->u.s); strcat(vs,b->u.s); v = make_str(vs); + free(vs); + /* free arguments */ free_value(a); free_value(b); -- cgit v1.2.3