Skip to content

Commit

Permalink
Merge ffb6196 into 2af16a7
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredfool committed May 30, 2016
2 parents 2af16a7 + ffb6196 commit 5153a6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions _imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -153,7 +155,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
if (self->font_bytes) {
PyMem_Free(self->font_bytes);
}
PyObject_Del(self);
Py_DECREF(self);
return geterror(error);
}

Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions map.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
NULL);
if (mapper->hFile == (HANDLE)-1) {
PyErr_SetString(PyExc_IOError, "cannot open file");
PyObject_Del(mapper);
Py_DECREF(mapper);
return NULL;
}

Expand All @@ -84,7 +84,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
if (mapper->hMap == (HANDLE)-1) {
CloseHandle(mapper->hFile);
PyErr_SetString(PyExc_IOError, "cannot map file");
PyObject_Del(mapper);
Py_DECREF(mapper);
return NULL;
}

Expand Down

0 comments on commit 5153a6d

Please sign in to comment.