mirror of
https://github.com/brl/mutter.git
synced 2025-04-13 05:39:38 +00:00
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:
parent
5eaf655224
commit
5e6d98e79f
@ -989,7 +989,7 @@ process_request_frame_extents (MetaX11Display *x11_display,
|
|||||||
32, PropModeReplace, (guchar*) data, 4);
|
32, PropModeReplace, (guchar*) data, 4);
|
||||||
meta_x11_error_trap_pop (x11_display);
|
meta_x11_error_trap_pop (x11_display);
|
||||||
|
|
||||||
meta_XFree (hints);
|
g_free (hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
|
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
|
||||||
|
@ -313,14 +313,7 @@ motif_hints_from_results (GetPropertyResults *results,
|
|||||||
* MotifWmHints than the one we expect, apparently. I'm not sure of
|
* MotifWmHints than the one we expect, apparently. I'm not sure of
|
||||||
* the history behind it. See bug #89841 for example.
|
* the history behind it. See bug #89841 for example.
|
||||||
*/
|
*/
|
||||||
*hints_p = calloc (1, sizeof (MotifWmHints));
|
*hints_p = g_new0 (MotifWmHints, 1);
|
||||||
if (*hints_p == NULL)
|
|
||||||
{
|
|
||||||
g_free (results->prop);
|
|
||||||
results->prop = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(*hints_p, results->prop, MIN (sizeof (MotifWmHints),
|
memcpy(*hints_p, results->prop, MIN (sizeof (MotifWmHints),
|
||||||
results->n_items * sizeof (uint32_t)));
|
results->n_items * sizeof (uint32_t)));
|
||||||
|
|
||||||
@ -1085,7 +1078,7 @@ free_value (MetaPropValue *value)
|
|||||||
g_free (value->v.str);
|
g_free (value->v.str);
|
||||||
break;
|
break;
|
||||||
case META_PROP_VALUE_MOTIF_HINTS:
|
case META_PROP_VALUE_MOTIF_HINTS:
|
||||||
free (value->v.motif_hints);
|
g_free (value->v.motif_hints);
|
||||||
break;
|
break;
|
||||||
case META_PROP_VALUE_CARDINAL:
|
case META_PROP_VALUE_CARDINAL:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user