summaryrefslogtreecommitdiff
path: root/main/ast_expr2.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-06-17 14:51:57 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-06-20 13:08:18 -0400
commit820ed3d4b35d5a906863375f0336e881530fa99c (patch)
tree76227e16c2da682f6101e5ab07254f25aa91ea67 /main/ast_expr2.c
parent947f76a971ee54bd263ca5b50ac9446618ae06b1 (diff)
fix: memory leaks, resource leaks, out of bounds and bugs
ASTERISK-26119 #close Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c
Diffstat (limited to 'main/ast_expr2.c')
-rw-r--r--main/ast_expr2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index c700b01d7..b914598ec 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -3669,13 +3669,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);