From 4a2dd2b7b5de8a9aeb1d8e795ad4fa58a0906589 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 28 Jul 2017 10:41:33 +0200 Subject: [PATCH] isl_scheduler.c: intra_dim_map: handle NULL input It is not clear if any of these inputs can be NULL in the current code base, but since the implementation depends on these inputs not being NULL, it is best to check anyway. In particular, if graph->lp is NULL, then the allocated isl_dim_map will be too small for the subsequent operations. Signed-off-by: Sven Verdoolaege --- isl_scheduler.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/isl_scheduler.c b/isl_scheduler.c index 434aae02..78dd51ac 100644 --- a/isl_scheduler.c +++ b/isl_scheduler.c @@ -1542,6 +1542,9 @@ static __isl_give isl_dim_map *intra_dim_map(isl_ctx *ctx, unsigned total; isl_dim_map *dim_map; + if (!node || !graph->lp) + return NULL; + total = isl_basic_set_total_dim(graph->lp); pos = node_var_coef_offset(node); dim_map = isl_dim_map_alloc(ctx, total); -- 2.11.4.GIT