Skip to content

suppress ASAN leak reports when aborting early

Evan Hunt requested to merge each-suppress-asan-on-abort into main

the address sanitizer reports memory leaks on shutdown, but this can be inappropriate when named exits early; for example, because of a configuration error. memory that has been allocated for the server may not have been freed when exit() is reached, but since this is not a normal shutdown, we don't actually care.

by changing ASAN_OPTIONS to include leak_check_on_exit=0, we suppress the behavior of checking for leaks whenever the server exits. by adding an explicit call to __lsan_do_leak_check() at the end of main(), we ensure that the leak check does occur when we shut down normally.

Merge request reports