From e2330617ac25511325000e05598695e66381d1bd Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Sep 2019 09:08:36 +0200 Subject: [PATCH] xprops: Free latin1/utf8_string_from_results() return value with g_free() latin1_string_from_results and utf8_string_from_results use g_strndup, so the returned string should be freed with g_free, rather then with free or XFree. This fixes all free-s of buffers returned by these 2 functions to properly use g_free. https://gitlab.gnome.org/GNOME/mutter/merge_requests/786 --- src/x11/window-x11.c | 4 ++-- src/x11/xprops.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 7d10a1092..6e502fd5d 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -180,7 +180,7 @@ update_sm_hints (MetaWindow *window) &str)) { window->sm_client_id = g_strdup (str); - meta_XFree (str); + g_free (str); } } else @@ -204,7 +204,7 @@ update_sm_hints (MetaWindow *window) window->desc); window->sm_client_id = g_strdup (str); - meta_XFree (str); + g_free (str); } } } diff --git a/src/x11/xprops.c b/src/x11/xprops.c index 10e56b60d..9e66fd5ad 100644 --- a/src/x11/xprops.c +++ b/src/x11/xprops.c @@ -993,7 +993,7 @@ meta_prop_get_values (MetaX11Display *x11_display, { char *new_str; new_str = latin1_to_utf8 (values[i].v.str); - free (values[i].v.str); + g_free (values[i].v.str); values[i].v.str = new_str; } break; @@ -1072,7 +1072,7 @@ free_value (MetaPropValue *value) break; case META_PROP_VALUE_UTF8: case META_PROP_VALUE_STRING: - free (value->v.str); + g_free (value->v.str); break; case META_PROP_VALUE_STRING_AS_UTF8: g_free (value->v.str);