Commit cfc7cac3c9f33fada3d3da1ba974f33ddb4ddfc5

Sam Lantinga 2022-12-08T12:43:23

Fixed memory leak when removing existing displays

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 6590ddb..6ec7ef5 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -640,6 +640,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;