isl_basic_map_overlying_set: avoid invalid access on error
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 2 Dec 2012 11:21:46 +0000 (12:21 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 2 Dec 2012 11:23:44 +0000 (12:23 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_map.c

index 7c9ac36..5821130 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -4354,10 +4354,12 @@ struct isl_basic_map *isl_basic_map_overlying_set(
                bmap = isl_basic_map_extend_constraints(bmap, 
                                                        0, 2 * like->n_div);
                for (i = 0; i < like->n_div; ++i) {
+                       if (!bmap)
+                               break;
                        if (isl_int_is_zero(bmap->div[i][0]))
                                continue;
                        if (isl_basic_map_add_div_constraints(bmap, i) < 0)
-                               goto error;
+                               bmap = isl_basic_map_free(bmap);
                }
        }
        isl_basic_map_free(like);