fix: memory leaks, resource leaks, out of bounds and bugs

ASTERISK-26119 #close

Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c
This commit is contained in:
Alexei Gradinari
2016-06-17 14:51:57 -04:00
parent 947f76a971
commit 820ed3d4b3
6 changed files with 74 additions and 25 deletions

View File

@@ -1662,13 +1662,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);