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

index b7cbebe..e6e48ce 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -1898,7 +1898,9 @@ struct isl_basic_map *isl_basic_map_intersect(
                        bmap2->n_div, bmap2->n_eq, bmap2->n_ineq);
        bmap1 = add_constraints(bmap1, bmap2, 0, 0);
 
-       if (sample) {
+       if (!bmap1)
+               isl_vec_free(sample);
+       else if (sample) {
                isl_vec_free(bmap1->sample);
                bmap1->sample = sample;
        }