1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix memleak with CHBLUPI channel

This commit is contained in:
Mathieu Schroeter 2017-08-11 23:14:48 +02:00
parent 8810e9afa9
commit d983422866

View File

@ -80,6 +80,9 @@ CPixmap::~CPixmap ()
if (tex.second.texMask)
SDL_DestroyTexture (tex.second.texMask);
}
if (m_lpSDLBlupi)
SDL_FreeSurface (m_lpSDLBlupi);
}
// Cr�e l'objet DirectDraw principal.
@ -228,7 +231,7 @@ bool CPixmap::Cache (
std::string file = GetBaseDir () + pFilename;
SDL_Surface * surface = IMG_Load (file.c_str ());
if (channel == CHBLUPI)
if (channel == CHBLUPI && !m_lpSDLBlupi)
m_lpSDLBlupi = surface;
SDL_Texture * texture = SDL_CreateTextureFromSurface (g_renderer, surface);