summaryrefslogtreecommitdiffstats
path: root/cfg.c
diff options
context:
space:
mode:
authornicm <nicm>2016-10-14 18:41:53 +0000
committernicm <nicm>2016-10-14 18:41:53 +0000
commit1721d1994eb03beb8217fa3e61ed0cc097dd899e (patch)
tree43e7b2ac7cfbfee0b83cb80f59133d9ee9e65f0f /cfg.c
parent0ec18e537d7f67732a789c0984bc1cb89dbb0adf (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 'cfg.c')
-rw-r--r--cfg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cfg.c b/cfg.c
index d45573ea..801056db 100644
--- a/cfg.c
+++ b/cfg.c
@@ -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;