aboutsummaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-03-18 19:47:55 +0100
committerWolfgang Müller2021-04-27 12:28:35 +0200
commit5ff1dc2b8f6ec0ab2ebdd132ba1b56cebeb9626c (patch)
tree704f4dfe1753cbbba0cf805400e4b4698c0e389a /conf.c
parent49be2ed2e13a61ba0ab2ae7cca44dcdc1829f3eb (diff)
downloadcwm-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.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/conf.c b/conf.c
index aa7d55c..6f66ba4 100644
--- a/conf.c
+++ b/conf.c
@@ -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]);