From b3eb48996af2236baf89dd5afd6cfeef1b5e86bd Mon Sep 17 00:00:00 2001 From: richiesams Date: Fri, 19 Jul 2013 12:17:14 -0500 Subject: [PATCH] ZVISION: Fix memory leaks --- engines/zvision/events.cpp | 2 +- engines/zvision/render_manager.cpp | 2 ++ engines/zvision/utility.cpp | 2 ++ engines/zvision/video.cpp | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index a3d6b6b6707..afa2d952071 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -65,7 +65,7 @@ void ZVision::processEvents() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; - delete _scaledVideoFrameBuffer; + delete[] _scaledVideoFrameBuffer; _scaledVideoFrameBuffer = 0; } break; diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 671e7c01368..6d3f7c6fc18 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -59,6 +59,8 @@ void RenderManager::renderImageToScreen(const Common::String &fileName, uint32 x stream.read(buffer, decompressedSize); _system->copyRectToScreen(buffer, width * 2, x, y, width, height); + + delete[] buffer; } else { // Reset the cursor file.seek(0); diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index bf8e5c91d61..fa29fe660f0 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -225,6 +225,8 @@ void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Com int16 *buffer = new int16[file.size()]; int readBytes = audioStream->readBuffer(buffer, file.size()); output.write(buffer, file.size() * 2); + + delete[] buffer; } } // End of namespace ZVision diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 0cca486af65..04280900032 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -118,7 +118,7 @@ void ZVision::continueVideo() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; - delete _scaledVideoFrameBuffer; + delete[] _scaledVideoFrameBuffer; _scaledVideoFrameBuffer = 0; }