From 0ea1184bcfefd1965670cf6d06ca9d44364460d2 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Thu, 30 Mar 2023 07:54:01 +1100 Subject: [PATCH] Free additional variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ondrej Baranovič <3819630+nulano@users.noreply.github.com> --- src/_imaging.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_imaging.c b/src/_imaging.c index c715c36c2..b6a7557ff 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -1250,6 +1250,7 @@ _histogram(ImagingObject *self, PyObject *args) { /* Build an integer list containing the histogram */ list = PyList_New(h->bands * 256); if (list == NULL) { + ImagingHistogramDelete(h); return NULL; } for (i = 0; i < h->bands * 256; i++) { @@ -2158,6 +2159,7 @@ _getcolors(ImagingObject *self, PyObject *args) { } else { out = PyList_New(colors); if (out == NULL) { + free(items); return NULL; } for (i = 0; i < colors; i++) {