From 448ab0a68780a32b754eb1edb42b4b45d85491af Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:36:58 +1100 Subject: [PATCH] Call FT_Done_MM_Var when returning early 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/_imagingft.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/_imagingft.c b/src/_imagingft.c index 92cfb1db0..e0c289865 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -1083,6 +1083,7 @@ font_getvarnames(FontObject *self) { num_namedstyles = master->num_namedstyles; list_names = PyList_New(num_namedstyles); if (list_names == NULL) { + FT_Done_MM_Var(library, master); return NULL; } @@ -1091,6 +1092,7 @@ font_getvarnames(FontObject *self) { error = FT_Get_Sfnt_Name(self->face, i, &name); if (error) { Py_DECREF(list_names); + FT_Done_MM_Var(library, master); return geterror(error); } @@ -1130,6 +1132,7 @@ font_getvaraxes(FontObject *self) { list_axes = PyList_New(num_axis); if (list_axes == NULL) { + FT_Done_MM_Var(library, master); return NULL; } for (i = 0; i < num_axis; i++) { @@ -1138,6 +1141,7 @@ font_getvaraxes(FontObject *self) { list_axis = PyDict_New(); if (list_axis == NULL) { Py_DECREF(list_axes); + FT_Done_MM_Var(library, master); return NULL; } PyObject *minimum = PyLong_FromLong(axis.minimum / 65536); @@ -1157,6 +1161,7 @@ font_getvaraxes(FontObject *self) { if (error) { Py_DECREF(list_axis); Py_DECREF(list_axes); + FT_Done_MM_Var(library, master); return geterror(error); }