From 8b39eb9b1ff885978816dd9663277608187e8676 Mon Sep 17 00:00:00 2001
From: Linus Probert <[EMAIL REDACTED]>
Date: Mon, 24 Apr 2023 20:48:42 +0200
Subject: [PATCH] wayland: Fixes a memory leak wheere primary selection isn't
freed
(cherry picked from commit 43f65a6ef08a502485c6107b255a9b22c890acd5)
---
src/video/wayland/SDL_waylandevents.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index fd2a97115dac..68268cd6c7dd 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -2383,6 +2383,13 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
SDL_free(input->data_device);
}
+ if (input->primary_selection_device != NULL) {
+ if (input->primary_selection_device->selection_offer != NULL) {
+ Wayland_primary_selection_offer_destroy(input->primary_selection_device->selection_offer);
+ }
+ SDL_free(input->primary_selection_device);
+ }
+
if (input->text_input != NULL) {
zwp_text_input_v3_destroy(input->text_input->text_input);
SDL_free(input->text_input);