isl_basic_map_intersect: avoid NULL pointer dereference
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 25 Jun 2010 16:34:58 +0000 (18:34 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 26 Jun 2010 15:37:39 +0000 (17:37 +0200)
isl_map.c

index ff46a29..7ac2900 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -1892,10 +1892,10 @@ struct isl_basic_map *isl_basic_map_intersect(
                sample = isl_vec_copy(bmap2->sample);
 
        bmap1 = isl_basic_map_cow(bmap1);
-       bmap1 = isl_basic_map_extend_dim(bmap1, isl_dim_copy(bmap1->dim),
-                       bmap2->n_div, bmap2->n_eq, bmap2->n_ineq);
        if (!bmap1)
                goto error;
+       bmap1 = isl_basic_map_extend_dim(bmap1, isl_dim_copy(bmap1->dim),
+                       bmap2->n_div, bmap2->n_eq, bmap2->n_ineq);
        bmap1 = add_constraints(bmap1, bmap2, 0, 0);
 
        if (sample) {