From a16a451c1f411b223066209ff7cd840f40c7757c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 27 Dec 2021 11:16:04 +0100 Subject: Fixed a possible memory leak in creating fonts --- font.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'font.c') diff --git a/font.c b/font.c index 2a92c34b..135d78f8 100644 --- a/font.c +++ b/font.c @@ -6,7 +6,7 @@ * * BiDi support by Osama Alrawab @2008 Tripoli-Libya. * - * $Id: font.c 4.2 2016/12/22 12:31:23 kls Exp $ + * $Id: font.c 4.2.1.1 2021/12/27 11:14:05 kls Exp $ */ #include "font.h" @@ -429,8 +429,10 @@ cFont *cFont::CreateFont(const char *Name, int CharHeight, int CharWidth) { cString fn = GetFontFileName(Name); cFont *f = *fn ? new cFreetypeFont(fn, CharHeight, CharWidth) : NULL; - if (!f || !f->Height()) + if (!f || !f->Height()) { + delete f; f = new cDummyFont(CharHeight, CharWidth); + } return f; } -- cgit v1.2.3