From 2b0194190bdd07b64b817883155608543a71a261 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 2 Dec 2012 15:35:49 +0100 Subject: [PATCH] isl_pw_*_on_shared_domain_in: avoid double free on error path Signed-off-by: Sven Verdoolaege --- isl_pw_templ.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/isl_pw_templ.c b/isl_pw_templ.c index 394571d7..f112fc02 100644 --- a/isl_pw_templ.c +++ b/isl_pw_templ.c @@ -538,9 +538,9 @@ static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1, n = pw1->n * pw2->n; #ifdef HAS_TYPE - res = FN(PW,alloc_size)(space, pw1->type, n); + res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n); #else - res = FN(PW,alloc_size)(space, n); + res = FN(PW,alloc_size)(isl_space_copy(space), n); #endif for (i = 0; i < pw1->n; ++i) { @@ -568,6 +568,7 @@ static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1, } } + isl_space_free(space); FN(PW,free)(pw1); FN(PW,free)(pw2); return res; -- 2.11.4.GIT