xprops: Use g_new0 instead of malloc in size_hints_from_results()

Switch the memory allocation in size_hints_from_results from a malloc call
without error-checking to g_new0 and adjust the free path accordingly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
This commit is contained in:
Hans de Goede 2019-09-09 15:40:12 +02:00 committed by Jonas Ådahl
parent e153524748
commit 8e510a07c4

View File

@ -772,7 +772,7 @@ size_hints_from_results (GetPropertyResults *results,
raw = (xPropSizeHints*) results->prop;
hints = malloc (sizeof (XSizeHints));
hints = g_new0 (XSizeHints, 1);
hints->flags = raw->flags;
hints->x = raw->x;
@ -1078,7 +1078,7 @@ free_value (MetaPropValue *value)
g_free (value->v.class_hint.res_name);
break;
case META_PROP_VALUE_SIZE_HINTS:
free (value->v.size_hints.hints);
g_free (value->v.size_hints.hints);
break;
case META_PROP_VALUE_UTF8_LIST:
g_strfreev (value->v.string_list.strings);