isl_pw_*_on_shared_domain_in: avoid double free on error path
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 2 Dec 2012 14:35:49 +0000 (2 15:35 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 2 Dec 2012 14:35:49 +0000 (2 15:35 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_pw_templ.c

index 394571d..f112fc0 100644 (file)
@@ -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;