summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cfg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-14 18:41:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-14 18:41:54 +0000
commit1f9195d8cf739e4124db4512200c8278bbda6957 (patch)
tree60eeed8298c3a96df1710a8e3faf3bbdddbf3df0 /usr.bin/tmux/cfg.c
parentfc344322183bb75d15302a2e4a01e50b291ec829 (diff)
source-file and some other commands can recurse back into cmdq_continue,
which could potentially free the currently running command, so we need to take a reference to it in cmdq_continue_one. Fixes problem reported by Theo Buehler.
Diffstat (limited to 'usr.bin/tmux/cfg.c')
-rw-r--r--usr.bin/tmux/cfg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index 4ccbf6d4d5e..86dd159ea67 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.47 2016/10/11 13:45:47 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.48 2016/10/14 18:41:53 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -129,7 +129,10 @@ load_cfg(const char *path, struct cmd_q *cmdq, int quiet)
static void
cfg_default_done(__unused struct cmd_q *cmdq)
{
- if (--cfg_references != 0)
+ log_debug("%s: %u references%s", __func__, cfg_references,
+ cfg_finished ? " (finished)" : "");
+
+ if (cfg_finished || --cfg_references != 0)
return;
cfg_finished = 1;