isl_basic_set_opt: avoid invalid access on error path
[platform/upstream/isl.git] / isl_mat.c
index a4b6e5a..cff8123 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -1,7 +1,7 @@
 /*
  * Copyright 2008-2009 Katholieke Universiteit Leuven
  *
- * 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, K.U.Leuven, Departement
  * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
@@ -909,6 +909,9 @@ struct isl_mat *isl_mat_transpose(struct isl_mat *mat)
        struct isl_mat *transpose = NULL;
        int i, j;
 
+       if (!mat)
+               return NULL;
+
        if (mat->n_col == mat->n_row) {
                mat = isl_mat_cow(mat);
                if (!mat)