From 086ca274fa5b21de8202e6175b73896c865a3ecd Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 13 Nov 2023 15:11:28 +1100 Subject: [PATCH] Decrement reference count for PyObject --- src/_imagingft.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_imagingft.c b/src/_imagingft.c index 64175de8b..7849c821d 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -885,7 +885,9 @@ font_render(FontObject *self, PyObject *args) { PyMem_Del(glyph_info); return NULL; } - id = PyLong_AsSsize_t(PyObject_GetAttrString(image, "id")); + PyObject *imageId = PyObject_GetAttrString(image, "id"); + id = PyLong_AsSsize_t(imageId); + Py_XDECREF(imageId); im = (Imaging)id; x_offset -= stroke_width;