From 9221cc7ec276166e81c21f1e12fe9eec75de02e5 Mon Sep 17 00:00:00 2001 From: Wayward Heart <91356680+WaywardHeart@users.noreply.github.com> Date: Sun, 2 Jun 2024 00:44:09 -0500 Subject: [PATCH] Fix major memory leak in Bitmap::initFromSurface c89f3d5bd7be432cca12c0629516bc2c18da79a6 accidentally completely removed the call to free the surface when successfully creating a texture. --- src/display/bitmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/display/bitmap.cpp b/src/display/bitmap.cpp index 86b11ae7..0ae67957 100644 --- a/src/display/bitmap.cpp +++ b/src/display/bitmap.cpp @@ -872,6 +872,8 @@ void Bitmap::initFromSurface(SDL_Surface *imgSurf, Bitmap *hiresBitmap, bool for TEX::bind(p->gl.tex); TEX::uploadImage(p->gl.width, p->gl.height, imgSurf->pixels, GL_RGBA); + + SDL_FreeSurface(imgSurf); } p->addTaintedArea(rect());