From 3b88d4f46f94e8adafc77ea0edd317b5e61d196c Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Fri, 21 Jun 2024 12:59:21 -0400 Subject: [PATCH] wayland: Fix double free when deleting an output display --- src/video/wayland/SDL_waylandvideo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 1c4155b620..d1b4d3a161 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -761,12 +761,11 @@ static void Wayland_free_display(SDL_VideoData *d, uint32_t id) Wayland_RemoveOutputFromWindow(window->driverdata, data->output); } - SDL_DelVideoDisplay(i); if (data->xdg_output) { zxdg_output_v1_destroy(data->xdg_output); } wl_output_destroy(data->output); - SDL_free(data); + SDL_DelVideoDisplay(i); /* Update the index for all remaining displays */ num_displays -= 1; @@ -1031,9 +1030,6 @@ static void Wayland_VideoCleanup(_THIS) } wl_output_destroy(((SDL_WaylandOutputData *)display->driverdata)->output); - SDL_free(display->driverdata); - display->driverdata = NULL; - SDL_DelVideoDisplay(i); } data->output_list = NULL;