isl_basic_set_expand_divs: avoid invalid access on error
[platform/upstream/isl.git] / isl_ast_codegen.c
index 33edeaa..9d4d93b 100644 (file)
@@ -1737,6 +1737,8 @@ static __isl_give isl_ast_graft_list *generate_sorted_domains(
        data.depth = isl_ast_build_get_depth(build);
        data.piece = domain_list->p;
        g = isl_tarjan_graph_init(ctx, n, &domain_follows_at_depth, &data);
+       if (!g)
+               goto error;
 
        i = 0;
        while (list && n) {
@@ -2587,6 +2589,9 @@ static __isl_give isl_basic_set_list *compute_domains(
        enum isl_ast_build_domain_type type;
        int empty;
 
+       if (!executed)
+               return NULL;
+
        ctx = isl_union_map_get_ctx(executed);
        domains.list = isl_basic_set_list_alloc(ctx, 0);