isl_basic_set_opt: avoid invalid access on error path
[platform/upstream/isl.git] / isl_reordering.c
index d99d7ac..30e2c8b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2010      INRIA Saclay
  *
- * Use of this software is governed by the GNU LGPLv2.1 license
+ * Use of this software is governed by the MIT license
  *
  * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
  * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
@@ -128,6 +128,8 @@ __isl_give isl_reordering *isl_parameter_alignment_reordering(
                }
        }
 
+       if (!exp->dim)
+               return isl_reordering_free(exp);
        return exp;
 error:
        isl_reordering_free(exp);
@@ -182,6 +184,9 @@ __isl_give isl_reordering *isl_reordering_extend_space(
 
        isl_reordering_free(exp);
 
+       if (!res->dim)
+               return isl_reordering_free(res);
+
        return res;
 error:
        isl_reordering_free(exp);