diff options
author | nicm <nicm> | 2015-02-12 09:56:19 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-02-12 09:56:19 +0000 |
commit | 4d05d8830482f8d5b5f812d082f1332090fcf027 (patch) | |
tree | 457004ec5c387efc0fe4cff9d4a8f2a1caf62850 /cmd-queue.c | |
parent | 9ae2284726a8fd37f73cf98b6e78dd7540e023af (diff) | |
download | rtmux-4d05d8830482f8d5b5f812d082f1332090fcf027.tar.gz rtmux-4d05d8830482f8d5b5f812d082f1332090fcf027.tar.bz2 rtmux-4d05d8830482f8d5b5f812d082f1332090fcf027.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 'cmd-queue.c')
-rw-r--r-- | cmd-queue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd-queue.c b/cmd-queue.c index 58282c8f..6be532a8 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -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); } |