isl_basic_map_order_divs: avoid NULL pointer dereference
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 25 Jun 2010 15:14:13 +0000 (17:14 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 26 Jun 2010 15:37:38 +0000 (17:37 +0200)
isl_map.c

index 186dc77..11cfb89 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -5384,7 +5384,12 @@ struct isl_set *isl_basic_set_union(
 struct isl_basic_map *isl_basic_map_order_divs(struct isl_basic_map *bmap)
 {
        int i;
-       unsigned off = isl_dim_total(bmap->dim);
+       unsigned off;
+
+       if (!bmap)
+               return NULL;
+
+       off = isl_dim_total(bmap->dim);
 
        for (i = 0; i < bmap->n_div; ++i) {
                int pos;