Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d102d39

Browse filesBrowse files
committed
Fix memory management revealed by using static freetype
1 parent 662ae7d commit d102d39
Copy full SHA for d102d39

File tree

Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-0
lines changed

‎src/ft2font.cpp

Copy file name to clipboardExpand all lines: src/ft2font.cpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ FT2Font::FT2Font(FT_Open_Args &open_args, long hinting_factor_) : image(), face(
511511
throw "Could not set the fontsize";
512512
}
513513

514+
if (open_args.stream != NULL) {
515+
face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
516+
}
517+
514518
static FT_Matrix transform = { 65536 / hinting_factor, 0, 0, 65536 };
515519
FT_Set_Transform(face, &transform, 0);
516520
}

‎src/ft2font_wrapper.cpp

Copy file name to clipboardExpand all lines: src/ft2font_wrapper.cpp
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,14 @@ static PyObject *PyFT2Font_new(PyTypeObject *type, PyObject *args, PyObject *kwd
463463
PyFT2Font *self;
464464
self = (PyFT2Font *)type->tp_alloc(type, 0);
465465
self->x = NULL;
466+
self->fname = NULL;
466467
self->py_file = NULL;
467468
self->fp = NULL;
468469
self->close_file = 0;
469470
self->offset = 0;
470471
memset(&self->stream, 0, sizeof(FT_StreamRec));
472+
self->mem = 0;
473+
self->mem_size = 0;
471474
return (PyObject *)self;
472475
}
473476

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.