isl_convex_hull.c: make sure we don't overallocate inequalities
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 20 Sep 2008 18:47:00 +0000 (20:47 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 12 Oct 2008 08:57:55 +0000 (10:57 +0200)
isl_convex_hull.c

index a239756..da35d26 100644 (file)
@@ -666,6 +666,11 @@ static struct isl_basic_set *extend(struct isl_ctx *ctx, struct isl_set *set,
                facet = compute_facet(ctx, set, hull->ineq[i]);
                if (!facet)
                        goto error;
+               if (facet->n_ineq + hull->n_ineq > n_ineq) {
+                       hull = isl_basic_set_extend(hull,
+                               hull->nparam, hull->dim, 0, 0, facet->n_ineq);
+                       n_ineq = hull->n_ineq + facet->n_ineq;
+               }
                for (j = 0; j < facet->n_ineq; ++j) {
                        k = isl_basic_set_alloc_inequality(hull);
                        if (k < 0)