From 13a2caae2ee1bbc922b6cdfaf441e58bebc8f205 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 12 Jan 2012 15:48:27 +0100 Subject: [PATCH] isl_multi_aff_set_aff: improve error handling Signed-off-by: Sven Verdoolaege --- isl_multi_templ.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/isl_multi_templ.c b/isl_multi_templ.c index 31699fe8..8949f3ba 100644 --- a/isl_multi_templ.c +++ b/isl_multi_templ.c @@ -144,9 +144,14 @@ __isl_give EL *FN(FN(MULTI(BASE),get),BASE)(__isl_keep MULTI(BASE) *multi, __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),set),BASE)( __isl_take MULTI(BASE) *multi, int pos, __isl_take EL *el) { + multi = FN(MULTI(BASE),cow)(multi); if (!multi || !el) goto error; + if (pos < 0 || pos >= multi->n) + isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, + "index out of bounds", goto error); + FN(EL,free)(multi->p[pos]); multi->p[pos] = el; -- 2.11.4.GIT