Fixed memory leak when removing existing displays

(cherry picked from commit cfc7cac3c9)
This commit is contained in:
Sam Lantinga committed 2022-12-08 12:46:50 -08:00
1 parent 653e484da1
commit 98fa97de91
1 file changed
+1
+1
View File
@@ -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;