Add necessary PyMem_Free and fix PyDict_GetItemRef call (#125)

This commit is contained in:
Hugo van Kemenade 2024-07-13 11:18:47 +02:00 committed by GitHub
commit c21a403879
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -1243,8 +1243,8 @@ font_getvarnames(FontObject *self) {
} }
} }
PyMem_Free(list_names_filled);
FT_Done_MM_Var(library, master); FT_Done_MM_Var(library, master);
return list_names; return list_names;
} }

View File

@ -723,8 +723,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
if (!is_core_tag) { if (!is_core_tag) {
PyObject *tag_type; PyObject *tag_type;
if (PyDict_GetItemRef(types, key, &tag_type) == 0) { if (PyDict_GetItemRef(types, key, &tag_type) < 0) {
PyErr_SetString(PyExc_KeyError, "unknown tag type"); return NULL; // Exception has been already set
} }
if (tag_type) { if (tag_type) {
int type_int = PyLong_AsLong(tag_type); int type_int = PyLong_AsLong(tag_type);