diff options
author | Strangerke | 2015-12-19 13:08:54 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:35:30 +0100 |
commit | 3fcd3c15262adb1b4ac9f69475df2a4145c450d3 (patch) | |
tree | 08542f2438b8e3a1ea9bc711392cd9dcf7421619 /engines/lab/dispman.cpp | |
parent | 7f5826cfcb72d1375d6c24b153a446fd9c92f623 (diff) | |
download | scummvm-rg350-3fcd3c15262adb1b4ac9f69475df2a4145c450d3.tar.gz scummvm-rg350-3fcd3c15262adb1b4ac9f69475df2a4145c450d3.tar.bz2 scummvm-rg350-3fcd3c15262adb1b4ac9f69475df2a4145c450d3.zip |
LAB: Avoid memory leaks with fonts
Diffstat (limited to 'engines/lab/dispman.cpp')
-rw-r--r-- | engines/lab/dispman.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index c928649c3a..ecf867b7cb 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -633,12 +633,13 @@ void DisplayMan::overlayRect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, u /** * Closes a font and frees all memory associated with it. */ -void DisplayMan::closeFont(TextFont *font) { - if (font) { - if (font->_data && font->_dataLength) - delete[] font->_data; +void DisplayMan::closeFont(TextFont **font) { + if (*font) { + if ((*font)->_data) + delete[] (*font)->_data; - delete font; + delete *font; + *font = nullptr; } } |