Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,15 @@ path_compact(PyPathObject *self, PyObject *args) {
}

i = self->count - j;
self->count = j;

/* shrink coordinate array */
/* malloc check ok, self->count is smaller than it was before */
self->xy = realloc(self->xy, 2 * self->count * sizeof(double));
double *new_xy = realloc(self->xy, 2 * j * sizeof(double));
if (!new_xy) {
return ImagingError_MemoryError();
}
self->xy = new_xy;
self->count = j;

return Py_BuildValue("i", i); /* number of removed vertices */
}
Expand Down
Loading