diff options
author | 2015-02-12 09:56:19 +0000 | |
---|---|---|
committer | 2015-02-12 09:56:19 +0000 | |
commit | f3cceb5b9e53fcc10f015d8b2ed42c84d9b0451d (patch) | |
tree | 9305f9d57502465eb524702cf57b0d740039eebe /usr.bin/tmux/cmd-queue.c | |
parent | Don't clear ICRNL when editing mode is off, so that character local echo (diff) | |
download | wireguard-openbsd-f3cceb5b9e53fcc10f015d8b2ed42c84d9b0451d.tar.xz wireguard-openbsd-f3cceb5b9e53fcc10f015d8b2ed42c84d9b0451d.zip |
Take a reference to prevent cmdq being freed during the command. Can
happen to cfg_cmd_q (possibly others) when source-file recurses into
cmdq_continue. Fixes bug reported by Ismail Donmez and Theo Buehler.
Diffstat (limited to 'usr.bin/tmux/cmd-queue.c')
-rw-r--r-- | usr.bin/tmux/cmd-queue.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index d357fca1daa..bd400d70080 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.21 2015/02/05 10:26:29 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.22 2015/02/12 09:56:19 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net> @@ -163,6 +163,7 @@ cmdq_continue(struct cmd_q *cmdq) int empty, flags; char s[1024]; + cmdq->references++; notify_disable(); empty = TAILQ_EMPTY(&cmdq->queue); @@ -220,11 +221,13 @@ empty: if (cmdq->client_exit > 0) cmdq->client->flags |= CLIENT_EXIT; if (cmdq->emptyfn != NULL) - cmdq->emptyfn(cmdq); /* may free cmdq */ + cmdq->emptyfn(cmdq); empty = 1; out: notify_enable(); + cmdq_free(cmdq); + return (empty); } |