mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
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:
parent
94bd5c7319
commit
6fbe4286ea
@ -155,7 +155,7 @@ atoms_to_mimetypes (MetaX11Display *display,
|
|||||||
|
|
||||||
for (i = 0; i < n_atoms; i++)
|
for (i = 0; i < n_atoms; i++)
|
||||||
{
|
{
|
||||||
const gchar *mimetype;
|
char *mimetype;
|
||||||
|
|
||||||
meta_x11_error_trap_push (display);
|
meta_x11_error_trap_push (display);
|
||||||
mimetype = XGetAtomName (xdisplay, atoms[i]);
|
mimetype = XGetAtomName (xdisplay, atoms[i]);
|
||||||
@ -170,6 +170,8 @@ atoms_to_mimetypes (MetaX11Display *display,
|
|||||||
text_plain_found |= strcmp (mimetype, "text/plain") == 0;
|
text_plain_found |= strcmp (mimetype, "text/plain") == 0;
|
||||||
utf8_string_found |= strcmp (mimetype, "UTF8_STRING") == 0;
|
utf8_string_found |= strcmp (mimetype, "UTF8_STRING") == 0;
|
||||||
string_found |= strcmp (mimetype, "STRING") == 0;
|
string_found |= strcmp (mimetype, "STRING") == 0;
|
||||||
|
|
||||||
|
XFree (mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure non-x11 clients get well-known mimetypes */
|
/* Ensure non-x11 clients get well-known mimetypes */
|
||||||
|
@ -185,7 +185,7 @@ meta_x11_selection_find_target (MetaX11Display *x11_display,
|
|||||||
{
|
{
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||||
GList* mimetypes = NULL;
|
GList* mimetypes = NULL;
|
||||||
const gchar *atom_name;
|
char *atom_name;
|
||||||
char *retval;
|
char *retval;
|
||||||
|
|
||||||
mimetypes = meta_selection_get_mimetypes (selection, selection_type);
|
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);
|
g_list_free_full (mimetypes, g_free);
|
||||||
|
XFree (atom_name);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user