From 1721d1994eb03beb8217fa3e61ed0cc097dd899e Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 14 Oct 2016 18:41:53 +0000 Subject: 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. --- cfg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cfg.c') 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; -- cgit