From a109d99c3fe2f321517e8ba47a471d7812de17dc Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 28 Nov 2017 17:00:12 +0100 Subject: [PATCH] gpu.c: create_domain_leaf: plug memory leak on error path In particular, if the allocation of the isl_id referencing the ppcg_kernel_stmt failed, then the ppcg_kernel_stmt does not get freed. Free it explicitly. Signed-off-by: Sven Verdoolaege --- gpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gpu.c b/gpu.c index 1166ab1..a8443d5 100644 --- a/gpu.c +++ b/gpu.c @@ -1884,6 +1884,8 @@ static __isl_give isl_ast_node *create_domain_leaf( id = isl_id_alloc(ctx, "user", stmt); id = isl_id_set_free_user(id, &ppcg_kernel_stmt_free); + if (!id) + ppcg_kernel_stmt_free(stmt); return isl_ast_node_set_annotation(node, id); } -- 2.11.4.GIT