isl_space_dup: avoid invalid accesses on error
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 30 Nov 2012 23:25:49 +0000 (00:25 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 1 Dec 2012 16:38:07 +0000 (17:38 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_space.c

index eaad1a6..bd7d15c 100644 (file)
@@ -292,6 +292,8 @@ __isl_take isl_space *isl_space_dup(__isl_keep isl_space *dim)
        if (!dim)
                return NULL;
        dup = isl_space_alloc(dim->ctx, dim->nparam, dim->n_in, dim->n_out);
+       if (!dup)
+               return NULL;
        if (dim->tuple_id[0] &&
            !(dup->tuple_id[0] = isl_id_copy(dim->tuple_id[0])))
                goto error;