From 46161823d9abff47985dceb9b9007f5e62678c6b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 25 Jun 2010 18:59:58 +0200 Subject: [PATCH] isl_map_simplify.c: remove_duplicate_divs: avoid NULL pointer dereference --- isl_map_simplify.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/isl_map_simplify.c b/isl_map_simplify.c index 25b8afec..18daf942 100644 --- a/isl_map_simplify.c +++ b/isl_map_simplify.c @@ -645,13 +645,16 @@ static struct isl_basic_map *remove_duplicate_divs( int k, l, h; int bits; struct isl_blk eq; - unsigned total_var = isl_dim_total(bmap->dim); - unsigned total = total_var + bmap->n_div; + unsigned total_var; + unsigned total; struct isl_ctx *ctx; - if (bmap->n_div <= 1) + if (!bmap || bmap->n_div <= 1) return bmap; + total_var = isl_dim_total(bmap->dim); + total = total_var + bmap->n_div; + ctx = bmap->ctx; for (k = bmap->n_div - 1; k >= 0; --k) if (!isl_int_is_zero(bmap->div[k][0])) -- 2.11.4.GIT