summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-source-file.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-10-14 18:41:53 +0000
committernicm <nicm@openbsd.org>2016-10-14 18:41:53 +0000
commit9a67a5aca97a93c3bc65bc72704b221b7a5a7660 (patch)
tree77a4da4c6dc2f5b0d97f5f9d5272ad626a48c7c6 /usr.bin/tmux/cmd-source-file.c
parentThe trailing producer index must point to the beginning of the message (diff)
downloadwireguard-openbsd-9a67a5aca97a93c3bc65bc72704b221b7a5a7660.tar.xz
wireguard-openbsd-9a67a5aca97a93c3bc65bc72704b221b7a5a7660.zip
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/cmd-source-file.c')
-rw-r--r--usr.bin/tmux/cmd-source-file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c
index ec95314f2aa..5f00d8273b9 100644
--- a/usr.bin/tmux/cmd-source-file.c
+++ b/usr.bin/tmux/cmd-source-file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-source-file.c,v 1.27 2016/10/13 22:48:51 nicm Exp $ */
+/* $OpenBSD: cmd-source-file.c,v 1.28 2016/10/14 18:41:53 nicm Exp $ */
/*
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
@@ -68,6 +68,8 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
}
+ log_debug("%s: cmdq %p, parent %p", __func__, cmdq1, cmdq);
+
cmdq->references++;
cfg_references++;
@@ -80,16 +82,15 @@ cmd_source_file_done(struct cmd_q *cmdq1)
{
struct cmd_q *cmdq = cmdq1->data;
+ log_debug("%s: cmdq %p, parent %p", __func__, cmdq1, cmdq);
+
if (cmdq1->client_exit >= 0)
cmdq->client_exit = cmdq1->client_exit;
-
cmdq_free(cmdq1);
cfg_references--;
-
if (cmdq_free(cmdq))
return;
-
if (cfg_references == 0)
cfg_print_causes(cmdq);
cmdq_continue(cmdq);