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.
This commit is contained in:
nicm
2016-10-14 18:41:53 +00:00
parent 0ec18e537d
commit 1721d1994e
3 changed files with 17 additions and 6 deletions

5
cfg.c
View File

@ -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;