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
This commit is contained in:
Hans de Goede 2019-09-09 09:08:36 +02:00 committed by Jonas Ådahl
parent 5e6d98e79f
commit e2330617ac
2 changed files with 4 additions and 4 deletions

View File

@ -180,7 +180,7 @@ update_sm_hints (MetaWindow *window)
&str)) &str))
{ {
window->sm_client_id = g_strdup (str); window->sm_client_id = g_strdup (str);
meta_XFree (str); g_free (str);
} }
} }
else else
@ -204,7 +204,7 @@ update_sm_hints (MetaWindow *window)
window->desc); window->desc);
window->sm_client_id = g_strdup (str); window->sm_client_id = g_strdup (str);
meta_XFree (str); g_free (str);
} }
} }
} }

View File

@ -993,7 +993,7 @@ meta_prop_get_values (MetaX11Display *x11_display,
{ {
char *new_str; char *new_str;
new_str = latin1_to_utf8 (values[i].v.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; values[i].v.str = new_str;
} }
break; break;
@ -1072,7 +1072,7 @@ free_value (MetaPropValue *value)
break; break;
case META_PROP_VALUE_UTF8: case META_PROP_VALUE_UTF8:
case META_PROP_VALUE_STRING: case META_PROP_VALUE_STRING:
free (value->v.str); g_free (value->v.str);
break; break;
case META_PROP_VALUE_STRING_AS_UTF8: case META_PROP_VALUE_STRING_AS_UTF8:
g_free (value->v.str); g_free (value->v.str);