From 6dd129532fbee7e326d94b22938ec591d1634ad2 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sat, 4 Jul 2020 21:39:56 +0100 Subject: [PATCH] Fixed mem leak after a VM restart. (Fixes #809) --- source/RGBMonitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/RGBMonitor.cpp b/source/RGBMonitor.cpp index 0f501456..7015023a 100644 --- a/source/RGBMonitor.cpp +++ b/source/RGBMonitor.cpp @@ -703,7 +703,8 @@ static LPBYTE g_pSourcePixels = NULL; static void V_CreateDIBSections(void) { - g_pSourcePixels = new BYTE[SRCOFFS_TOTAL * MAX_SOURCE_Y]; + if (!g_pSourcePixels) // NB. Will be non-zero after a VM restart (GH#809) + g_pSourcePixels = new BYTE[SRCOFFS_TOTAL * MAX_SOURCE_Y]; // CREATE THE OFFSET TABLE FOR EACH SCAN LINE IN THE SOURCE IMAGE for (int y = 0; y < MAX_SOURCE_Y; y++)