From 3f1bb66959dbe72444d7cd1bc36609bf1e3e2f77 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Dec 2015 22:16:06 +0100 Subject: LAB: Fix memory leak --- engines/lab/dispman.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/lab') diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 28d691a963..fd7486e3fa 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -66,6 +66,7 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { DisplayMan::~DisplayMan() { freePict(); delete _dispBitMap; + delete[]_displayBuffer; } // From readPict.c. Reads in pictures and animations from disk. @@ -543,7 +544,10 @@ void DisplayMan::createScreen(bool hiRes) { _screenHeight = 200; } _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! + + if (_displayBuffer) + delete[] _displayBuffer; + _displayBuffer = new byte[_screenBytesPerPage]; } /** -- cgit v1.2.3