xprops: Use g_new0 instead of calloc in meta_prop_get_motif_hints()

Use g_new0 instead of calloc for motif_hints_from_results and adjust
its callers to use g_free.

Note that in the process_request_frame_extents function this replaces
the wrong original mismatch of calloc + XFree with a matching g_malloc +
g_free pair.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
This commit is contained in:
Hans de Goede 2019-09-09 09:18:45 +02:00 committed by Jonas Ådahl
parent 5eaf655224
commit 5e6d98e79f
2 changed files with 3 additions and 10 deletions

View File

@ -989,7 +989,7 @@ process_request_frame_extents (MetaX11Display *x11_display,
32, PropModeReplace, (guchar*) data, 4);
meta_x11_error_trap_pop (x11_display);
meta_XFree (hints);
g_free (hints);
}
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */

View File

@ -313,14 +313,7 @@ motif_hints_from_results (GetPropertyResults *results,
* MotifWmHints than the one we expect, apparently. I'm not sure of
* the history behind it. See bug #89841 for example.
*/
*hints_p = calloc (1, sizeof (MotifWmHints));
if (*hints_p == NULL)
{
g_free (results->prop);
results->prop = NULL;
return FALSE;
}
*hints_p = g_new0 (MotifWmHints, 1);
memcpy(*hints_p, results->prop, MIN (sizeof (MotifWmHints),
results->n_items * sizeof (uint32_t)));
@ -1085,7 +1078,7 @@ free_value (MetaPropValue *value)
g_free (value->v.str);
break;
case META_PROP_VALUE_MOTIF_HINTS:
free (value->v.motif_hints);
g_free (value->v.motif_hints);
break;
case META_PROP_VALUE_CARDINAL:
break;