x11: Fix remaining leaks from switch to XGetAtomName()

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: e66f4396e ("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
This commit is contained in:
Sebastian Keller 2023-04-13 01:36:45 +02:00 committed by Marge Bot
parent 94bd5c7319
commit 6fbe4286ea
2 changed files with 5 additions and 2 deletions

View File

@ -155,7 +155,7 @@ atoms_to_mimetypes (MetaX11Display *display,
for (i = 0; i < n_atoms; i++)
{
const gchar *mimetype;
char *mimetype;
meta_x11_error_trap_push (display);
mimetype = XGetAtomName (xdisplay, atoms[i]);
@ -170,6 +170,8 @@ atoms_to_mimetypes (MetaX11Display *display,
text_plain_found |= strcmp (mimetype, "text/plain") == 0;
utf8_string_found |= strcmp (mimetype, "UTF8_STRING") == 0;
string_found |= strcmp (mimetype, "STRING") == 0;
XFree (mimetype);
}
/* Ensure non-x11 clients get well-known mimetypes */

View File

@ -185,7 +185,7 @@ meta_x11_selection_find_target (MetaX11Display *x11_display,
{
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
GList* mimetypes = NULL;
const gchar *atom_name;
char *atom_name;
char *retval;
mimetypes = meta_selection_get_mimetypes (selection, selection_type);
@ -213,6 +213,7 @@ meta_x11_selection_find_target (MetaX11Display *x11_display,
}
g_list_free_full (mimetypes, g_free);
XFree (atom_name);
return retval;
}