fix(lifecycle): json_create_config leak

Problem:
As it turns out, when you have 17 different ways to "exit", you need to
plug 17 different holes.

Leak still reported by ASAN CI, even after 1eae512285 f238788601.

    ERROR: LeakSanitizer: detected memory leaks
        strbuf_init src/cjson/strbuf.c:62:22
        json_create_config src/cjson/lua_cjson.c:635:5
        lua_cjson_new src/cjson/lua_cjson.c:2060:5
        nlua_state_add_stdlib src/nvim/lua/stdlib.c:840:3
        nlua_state_init src/nvim/lua/executor.c:973:3

Analysis:
`os_breakcheck()` may process a `exit_event` placed by
`exit_on_closed_chan()` during shutdown. This would re-enter
`preserve_exit()`, which then skips everything because it sees
`really_exiting=true`.

Solution:
Set `exiting` in `preserve_exit()`, not only in `getout()`.
This commit is contained in:
Justin M. Keyes
2026-08-18 21:30:05 +02:00
parent c184ca2c68
commit 73e766f8f6

View File

@@ -897,6 +897,8 @@ void preserve_exit(const char *errmsg)
}
really_exiting = true;
// Set this now, to neuter a stray `exit_event` on the event-loop. #39675
exiting = true;
// Ignore SIGHUP while we are already exiting. #9274
signal_reject_deadly();