From 7673cb7549e5071d39e76419204c56b0f07199bb Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Sat, 19 Dec 2020 14:57:55 -0800 Subject: [PATCH] Fix dereferencing potential null pointer --- src/_imaging.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/_imaging.c b/src/_imaging.c index 3635d2afa..53a03fc88 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -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];