From c9c6724ca91df2ef1819e5c9f55a8ceef2588daa Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 12 May 2010 11:33:33 +0200 Subject: [PATCH] isl_mat_lin_to_aff: fix error handling --- isl_mat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/isl_mat.c b/isl_mat.c index 6f4f889..244eb0c 100644 --- a/isl_mat.c +++ b/isl_mat.c @@ -523,7 +523,7 @@ struct isl_mat *isl_mat_lin_to_aff(struct isl_mat *mat) return NULL; mat2 = isl_mat_alloc(mat->ctx, 1+mat->n_row, 1+mat->n_col); if (!mat2) - return NULL; + goto error; isl_int_set_si(mat2->row[0][0], 1); isl_seq_clr(mat2->row[0]+1, mat->n_col); for (i = 0; i < mat->n_row; ++i) { @@ -532,6 +532,9 @@ struct isl_mat *isl_mat_lin_to_aff(struct isl_mat *mat) } isl_mat_free(mat); return mat2; +error: + isl_mat_free(mat); + return NULL; } static int row_first_non_zero(isl_int **row, unsigned n_row, unsigned col) -- 2.7.4