mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
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:
parent
1574099449
commit
80ceeb2848
@ -1654,7 +1654,7 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
|
|||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
MetaKeyBinding *binding;
|
MetaKeyBinding *binding;
|
||||||
MetaKeyGrab *grab;
|
MetaKeyGrab *grab;
|
||||||
char *key;
|
g_autofree char *key = NULL;
|
||||||
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
|
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
|
||||||
|
|
||||||
g_return_val_if_fail (action != META_KEYBINDING_ACTION_NONE, FALSE);
|
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_hash_table_remove (external_grabs, key);
|
||||||
g_free (key);
|
|
||||||
resolved_key_combo_reset (&resolved_combo);
|
resolved_key_combo_reset (&resolved_combo);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user