mirror of
https://github.com/neovim/neovim.git
synced 2026-08-26 00:51:53 +00:00
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 after1eae512285f238788601. 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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user