From cf30e0f9357b7e42491645a87eeae06ffb8e8066 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 30 Jun 2019 19:21:53 +0000 Subject: [PATCH] Do not double free window if pane fails to start. --- spawn.c | 4 +--- tmux.h | 1 - window.c | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/spawn.c b/spawn.c index bae220e1..08d0426c 100644 --- a/spawn.c +++ b/spawn.c @@ -172,10 +172,8 @@ spawn_window(struct spawn_context *sc, char **cause) /* Spawn the pane. */ wp = spawn_pane(sc, cause); if (wp == NULL) { - if (~sc->flags & SPAWN_RESPAWN) { - window_destroy(w); + if (~sc->flags & SPAWN_RESPAWN) winlink_remove(&s->windows, sc->wl); - } return (NULL); } diff --git a/tmux.h b/tmux.h index 7126b30f..d6dacf63 100644 --- a/tmux.h +++ b/tmux.h @@ -2362,7 +2362,6 @@ struct window *window_find_by_id_str(const char *); struct window *window_find_by_id(u_int); void window_update_activity(struct window *); struct window *window_create(u_int, u_int); -void window_destroy(struct window *); void window_pane_set_event(struct window_pane *); struct window_pane *window_get_active_at(struct window *, u_int, u_int); struct window_pane *window_find_string(struct window *, const char *); diff --git a/window.c b/window.c index 65097e1c..06145221 100644 --- a/window.c +++ b/window.c @@ -338,7 +338,7 @@ window_create(u_int sx, u_int sy) return (w); } -void +static void window_destroy(struct window *w) { log_debug("window @%u destroyed (%d references)", w->id, w->references);