From 5a4b67dd9e31e2e261eecc2617083d02c780c08c Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Wed, 12 Apr 2023 23:27:41 +0200 Subject: [PATCH] wayland: Don't leak XDnD mime type strings After this got changed from gdk_x11_get_xatom_name() to XGetAtomName(), this no longer returns a const char* and it now also needs to be freed. Fixes: 014cde646 ("wayland: Do not use GDK functions on XDnD implementation") Part-of: --- src/wayland/meta-xwayland-dnd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c index bae1d3736..dc10da5bb 100644 --- a/src/wayland/meta-xwayland-dnd.c +++ b/src/wayland/meta-xwayland-dnd.c @@ -737,7 +737,7 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source, for (i = 0; i < nitems_ret; i++) { - const gchar *mime_type; + char *mime_type; if (atoms[i] == utf8_string) { @@ -748,6 +748,7 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source, mime_type = XGetAtomName (xdisplay, atoms[i]); meta_wayland_data_source_add_mime_type (source, mime_type); + XFree (mime_type); } XFree (atoms); @@ -933,7 +934,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor, if (!(event->data.l[1] & 1)) { /* Mimetypes are contained in this message */ - const gchar *mimetype; + char *mimetype; gint i; struct wl_array *source_mime_types; @@ -950,6 +951,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor, mimetype = XGetAtomName (xdisplay, event->data.l[i]); meta_wayland_data_source_add_mime_type (dnd->source, mimetype); + XFree (mimetype); } } }