mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
rcxml.c: fix mem leak when deduplicating keybinds
Before this patch `keybind->keysyms` wasn't free'd when - deduplicating keybinds - removing keybinds due to empty action list This patch creates a shared `keybind_destroy()` helper which gets used in all cases where a keybind is destroyed.
This commit is contained in:
parent
07110d41ff
commit
6754801052
3 changed files with 14 additions and 4 deletions
|
|
@ -1626,7 +1626,7 @@ deduplicate_key_bindings(void)
|
|||
if (keybind_the_same(existing, current)) {
|
||||
wl_list_remove(&existing->link);
|
||||
action_list_free(&existing->actions);
|
||||
free(existing);
|
||||
keybind_destroy(existing);
|
||||
replaced++;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1635,7 +1635,7 @@ deduplicate_key_bindings(void)
|
|||
wl_list_for_each_safe(current, tmp, &rc.keybinds, link) {
|
||||
if (wl_list_empty(¤t->actions)) {
|
||||
wl_list_remove(¤t->link);
|
||||
free(current);
|
||||
keybind_destroy(current);
|
||||
cleared++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1948,8 +1948,7 @@ rcxml_finish(void)
|
|||
wl_list_for_each_safe(k, k_tmp, &rc.keybinds, link) {
|
||||
wl_list_remove(&k->link);
|
||||
action_list_free(&k->actions);
|
||||
zfree(k->keysyms);
|
||||
zfree(k);
|
||||
keybind_destroy(k);
|
||||
}
|
||||
|
||||
struct mousebind *m, *m_tmp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue