From 3192178f15c9bcc88021ceb74189173d562e7694 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 17 Jul 2015 06:53:47 +0000 Subject: [PATCH 1/2] Initialize client fd to -1 as well, from Bobby Powers. --- server-client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/server-client.c b/server-client.c index 09348b05..c2c7070f 100644 --- a/server-client.c +++ b/server-client.c @@ -96,6 +96,7 @@ server_client_create(int fd) environ_init(&c->environ); + c->fd = -1; c->cwd = -1; c->cmdq = cmdq_new(c); From bad8d0fd200c7718a8f51f52b9dd2f23c74d996f Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 17 Jul 2015 13:09:07 +0000 Subject: [PATCH 2/2] Do not call window_unzoom from window_destroy because it will try to add a notification which will get confused because the reference count is already zero and end up back in window_destroy and a double free. Instead, just destroy the layouts directly. Noticed by Thomas Adam. --- window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/window.c b/window.c index 82c10606..6351eff5 100644 --- a/window.c +++ b/window.c @@ -341,12 +341,12 @@ window_create(const char *name, int argc, char **argv, const char *path, void window_destroy(struct window *w) { - window_unzoom(w); - RB_REMOVE(windows, &windows, w); if (w->layout_root != NULL) - layout_free(w); + layout_free_cell(w->layout_root); + if (w->saved_layout_root != NULL) + layout_free_cell(w->saved_layout_root); free(w->old_layout); if (event_initialized(&w->name_timer))