git/compat/win32
Johannes Schindelin 9184231173 mingw: make `exit_process()` own the process handle on all paths
After "mingw: kill child processes in a gentler way", the ownership of
the HANDLE passed to `exit_process()` and `terminate_process_tree()` is
inconsistent. `terminate_process_tree()` always closes the handle;
`exit_process()` closes it on success and on the terminate-tree
fallback, but leaks it on the early return where GetExitCodeProcess()
fails or reports the process is no longer STILL_ACTIVE.

`mingw_kill()` compensated by closing the handle on its own error path,
which is a double-close on every error path that does not hit that one
leaky branch -- the callee has already closed the handle by then.
Coverity flagged the resulting use-after-free as CID 1437238.

Pin down the invariant that `exit_process()` and
`terminate_process_tree()` own the handle from the call onward and close
it on every return path; with that, the bogus close in `mingw_kill()`
goes away.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-07-05 09:12:10 -07:00
..
alloca.h
dirent.c mingw: teach dirent about symlinks 2026-01-09 18:32:55 -08:00
dirent.h Win32: Unicode file name support (dirent) 2014-07-15 11:19:09 -07:00
exit-process.h mingw: make `exit_process()` own the process handle on all paths 2026-07-05 09:12:10 -07:00
flush.c unify and bump _WIN32_WINNT definition to Windows 8.1 2026-04-06 10:06:20 -07:00
git.manifest mingw: embed a manifest to trick UAC into Doing The Right Thing 2019-06-27 12:55:45 -07:00
headless.c compat/win32: fix -Wsign-compare warning in "wWinMain()" 2024-12-06 20:20:01 +09:00
lazyload.h lazyload: use correct calling conventions 2022-01-09 10:34:53 -08:00
path-utils.c environment: guard state depending on a repository 2024-09-12 10:15:42 -07:00
path-utils.h win32: override `fspathcmp()` with a directory separator-aware version 2024-07-13 16:23:36 -07:00
pthread.c compat/win32: add pthread_cond_timedwait 2026-04-15 08:44:32 -07:00
pthread.h compat/win32: add pthread_cond_timedwait 2026-04-15 08:44:32 -07:00
syslog.c compat: mark unused parameters in win32/mingw functions 2024-08-28 09:51:18 -07:00
syslog.h
trace2_win32_process_info.c trace2: emit cmd_ancestry data for Windows 2026-02-13 12:18:31 -08:00