diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2021-02-17 17:46:16 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2021-02-20 14:40:24 -0500 |
commit | eb36c03e83ecc110bb14480fca911ef45621f24a (patch) | |
tree | c878e8d308bd7fff22e7d9c628cc860b59129b3d /tests | |
parent | 09363500b9e161670b6bd084cc57bff75d32fc02 (diff) | |
download | curl-eb36c03e83ecc110bb14480fca911ef45621f24a.tar.gz |
memdebug: close debug logfile explicitly on exit
- Use atexit to register a dbg cleanup function that closes the logfile.
LeakSantizier (LSAN) calls _exit() instead of exit() when a leak is
detected on exit so the logfile must be closed explicitly or data could
be lost. Though _exit() does not call atexit handlers such as this,
LSAN's call to _exit() comes after the atexit handlers are called.
Prior to this change the logfile was not explicitly closed so it was
possible that if LSAN detected a leak and called _exit (which does
not flush or close files like exit) then the logfile could be missing
data. That could then cause curl's memanalyze to report false leaks
(eg a malloc was recorded to the logfile but the corresponding free was
discarded from the buffer instead of written to the logfile, then
memanalyze reports that as a leak).
Ref: https://github.com/google/sanitizers/issues/1374
Bug: https://github.com/curl/curl/pull/6591#issuecomment-780396541
Closes https://github.com/curl/curl/pull/6620
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions