diff options
author | Sebastian Keller <skeller@gnome.org> | 2023-04-12 23:27:41 +0200 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2023-04-14 13:27:19 +0000 |
commit | 5a4b67dd9e31e2e261eecc2617083d02c780c08c (patch) | |
tree | ae3a3996f4f4af74aaa36adb9bb967065b8e10c6 | |
parent | 47b6e76578edc34ca1a8526d5c067eea1591a9aa (diff) | |
download | mutter-5a4b67dd9e31e2e261eecc2617083d02c780c08c.tar.gz |
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
-rw-r--r-- | src/wayland/meta-xwayland-dnd.c | 6 |
1 files 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); } } } |