From 98fa97de91b79b842779de6d12428bcad9b881f8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Dec 2022 12:43:23 -0800 Subject: [PATCH] Fixed memory leak when removing existing displays (cherry picked from commit cfc7cac3c9f33fada3d3da1ba974f33ddb4ddfc5) --- src/video/SDL_video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 905ab8640f..04d78afed7 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -623,6 +623,7 @@ void SDL_DelVideoDisplay(int index) SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0); if (index < (_this->num_displays - 1)) { + SDL_free(_this->displays[index].driverdata); SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index])); } --_this->num_displays;