From 48f8a7fdfa656a385dc2c3205f722bc765df3858 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 19 Jun 2010 11:03:38 +0200 Subject: [PATCH] isl_point_alloc: avoid potential memory leak on error path --- isl_point.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/isl_point.c b/isl_point.c index 9177c344..b7a7e100 100644 --- a/isl_point.c +++ b/isl_point.c @@ -13,10 +13,6 @@ __isl_give isl_point *isl_point_alloc(__isl_take isl_dim *dim, if (!dim || !vec) goto error; - pnt = isl_alloc_type(dim->ctx, struct isl_point); - if (!pnt) - goto error; - if (vec->size > 1 + isl_dim_total(dim)) { vec = isl_vec_cow(vec); if (!vec) @@ -24,6 +20,10 @@ __isl_give isl_point *isl_point_alloc(__isl_take isl_dim *dim, vec->size = 1 + isl_dim_total(dim); } + pnt = isl_alloc_type(dim->ctx, struct isl_point); + if (!pnt) + goto error; + pnt->ref = 1; pnt->dim = dim; pnt->vec = vec; -- 2.11.4.GIT