Browse code

cid 12192/12191 - fix error state in allocating memory for regex cflags in sigtool

Kevin Lin authored on 2015/08/18 06:39:55
Showing 1 changed files
... ...
@@ -2462,6 +2462,7 @@ static int decodehex(const char *hexsig)
2462 2462
 	regex = cli_calloc(rlen+1, sizeof(char));
2463 2463
 	if (!regex) {
2464 2464
 	    mprintf("!cannot allocate memory for regex expression\n");
2465
+	    free(trigger);
2465 2466
 	    return -1;
2466 2467
 	}
2467 2468
 	strncpy(regex, hexsig+tlen+1, rlen);
... ...
@@ -2472,6 +2473,8 @@ static int decodehex(const char *hexsig)
2472 2472
 	    cflags = cli_calloc(clen+1, sizeof(char));
2473 2473
 	    if (!cflags) {
2474 2474
 		mprintf("!cannot allocate memory for compile flags\n");
2475
+		free(trigger);
2476
+		free(regex);
2475 2477
 		return -1;
2476 2478
 	    }
2477 2479
 	    strncpy(cflags, hexsig+tlen+rlen+2, clen);