Add necessary PyMem_Free and fix PyDict_GetItemRef call

This commit is contained in:
Lysandros Nikolaou 2024-07-13 11:00:57 +02:00
parent 40e7f511b3
commit f5313db9ce
No known key found for this signature in database
GPG Key ID: 43E92D11D08F5F29
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);
return list_names;
}

View File

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