isl_basic_set_opt: avoid invalid access on error path
[platform/upstream/isl.git] / isl_mat.c
index 6cd90e0..cff8123 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -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)