mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
Initialize ptr and guard call to free
This commit is contained in:
parent
72c45e6f5d
commit
ffb61968f0
|
@ -119,7 +119,9 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
|||
PyMem_Free(filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
self->face = NULL;
|
||||
|
||||
if (filename && font_bytes_size <= 0) {
|
||||
self->font_bytes = NULL;
|
||||
error = FT_New_Face(library, filename, index, &self->face);
|
||||
|
@ -440,7 +442,9 @@ font_render(FontObject* self, PyObject* args)
|
|||
static void
|
||||
font_dealloc(FontObject* self)
|
||||
{
|
||||
FT_Done_Face(self->face);
|
||||
if (self->face) {
|
||||
FT_Done_Face(self->face);
|
||||
}
|
||||
if (self->font_bytes) {
|
||||
PyMem_Free(self->font_bytes);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user