Fix dereferencing potential null pointer

This commit is contained in:
Christoph Gohlke 2020-12-19 14:57:55 -08:00 committed by GitHub
parent c52c3ae3e2
commit 7673cb7549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3180,6 +3180,10 @@ _draw_polygon(ImagingDrawObject* self, PyObject* args)
/* Copy list of vertices to array */
ixy = (int*) calloc(n, 2 * sizeof(int));
if (ixy == NULL) {
free(xy);
return NULL;
}
for (i = 0; i < n; i++) {
ixy[i+i] = (int) xy[i+i];