keybindings: Fix theoretical memory leak while ungrabbing

In the unlikely event that one tries to ungrab an action which does not
exist, a small leak could occur. Fix this by using g_autofree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/478
This commit is contained in:
Benjamin Berg 2019-03-06 14:07:02 +01:00 committed by Georges Basile Stavracas Neto
parent 1574099449
commit 80ceeb2848

View File

@ -1654,7 +1654,7 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
MetaKeyBindingManager *keys = &display->key_binding_manager;
MetaKeyBinding *binding;
MetaKeyGrab *grab;
char *key;
g_autofree char *key = NULL;
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
g_return_val_if_fail (action != META_KEYBINDING_ACTION_NONE, FALSE);
@ -1683,7 +1683,6 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
}
g_hash_table_remove (external_grabs, key);
g_free (key);
resolved_key_combo_reset (&resolved_combo);
return TRUE;