diff options
author | Wynn Wolf Arbor | 2020-03-18 19:47:55 +0100 |
---|---|---|
committer | Wolfgang Müller | 2021-04-27 12:28:35 +0200 |
commit | 5ff1dc2b8f6ec0ab2ebdd132ba1b56cebeb9626c (patch) | |
tree | 704f4dfe1753cbbba0cf805400e4b4698c0e389a | |
parent | 49be2ed2e13a61ba0ab2ae7cca44dcdc1829f3eb (diff) | |
download | cwm-5ff1dc2b8f6ec0ab2ebdd132ba1b56cebeb9626c.tar.gz |
Plug a memory leak in conf_clear
These loops never freed cargs and cargs->cmd from bind_ctx. Instead of
adding more calls to free() manually, replace the whole loops with the
conf_unbind_* functions which free the struct properly.
Diffstat (limited to '')
-rw-r--r-- | conf.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -320,7 +320,6 @@ void conf_clear(struct conf *c) { struct autogroup *ag; - struct bind_ctx *kb, *mb; struct winname *wn; struct cmd_ctx *cmd, *wm; int i; @@ -337,10 +336,7 @@ conf_clear(struct conf *c) free(wm->path); free(wm); } - while ((kb = TAILQ_FIRST(&c->keybindq)) != NULL) { - TAILQ_REMOVE(&c->keybindq, kb, entry); - free(kb); - } + conf_unbind_key(c, NULL); while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) { TAILQ_REMOVE(&c->autogroupq, ag, entry); free(ag->class); @@ -352,10 +348,7 @@ conf_clear(struct conf *c) free(wn->name); free(wn); } - while ((mb = TAILQ_FIRST(&c->mousebindq)) != NULL) { - TAILQ_REMOVE(&c->mousebindq, mb, entry); - free(mb); - } + conf_unbind_mouse(c, NULL); for (i = 0; i < CWM_COLOR_NITEMS; i++) free(c->color[i]); |