From b83abe436d9b8d5997b171f5c981ddc13cf61e8a Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 17 Dec 2015 14:56:14 +0100 Subject: [PATCH] tree2scop.c: scop_add_kill: plug memory leak If an error occurs or if the expression cannot be killed, one of the arguments would not get freed. The memory leak was introduced in b3c3e43 (add support for __pencil_kill, Fri Oct 17 15:30:38 2014 +0200). Signed-off-by: Sven Verdoolaege --- tree2scop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tree2scop.c b/tree2scop.c index 38de5f6..893b4ed 100644 --- a/tree2scop.c +++ b/tree2scop.c @@ -294,6 +294,7 @@ static struct pet_scop *scop_add_kill(struct pet_scop *scop, if (!expr) goto error; if (expr->n_arg != 0) { + pet_loc_free(loc); pet_expr_free(expr); return scop; } @@ -317,6 +318,7 @@ static struct pet_scop *scop_add_kill(struct pet_scop *scop, return scop; error: pet_expr_free(expr); + pet_loc_free(loc); return pet_scop_free(scop); } -- 2.11.4.GIT