From 61f55f3e282bb16939f4675d619184e48a70a440 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Tue, 12 May 2020 22:45:08 -0400 Subject: [PATCH] Ensure that pallette variable has been freed before attempting malloc a new heap. --- src/drivers/common/vidblit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/drivers/common/vidblit.cpp b/src/drivers/common/vidblit.cpp index 7a3eb0f9..d93c520a 100644 --- a/src/drivers/common/vidblit.cpp +++ b/src/drivers/common/vidblit.cpp @@ -218,6 +218,11 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int return(0); //allocate adequate room for 32bpp palette + if ( palettetranslate ) + { + free(palettetranslate); + palettetranslate=NULL; + } palettetranslate=(uint32*)FCEU_dmalloc(256*4 + 512*4); if(!palettetranslate)