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