}
static gdPoint *points;
-static int points_allocated;
+static size_t points_allocated;
static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
{
fill_ok = filled && obj->fillcolor.u.index != gdImageGetTransparent(im);
if (pen_ok || fill_ok) {
- if (n > points_allocated) {
- points = realloc(points, n * sizeof(gdPoint));
- points_allocated = n;
+ if (n > 0 && (size_t)n > points_allocated) {
+ points = realloc(points, (size_t)n * sizeof(gdPoint));
+ points_allocated = (size_t)n;
}
for (i = 0; i < n; i++) {
points[i].x = ROUND(A[i].x);