mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
fix(shutdown): use exit() under AddressSanitizer
system_exit() (= _exit()) on Linux skips C++ destructors and atexit hooks, including ASan's leak-and-error report. Under sanitizer builds we want that report. Switch to plain exit() when __SANITIZE_ADDRESS__ is defined; native posix shutdown still uses _exit().
This commit is contained in:
@@ -283,7 +283,11 @@ static void shutdown_worker(void *arg)
|
||||
#elif defined(__PX4_POSIX)
|
||||
// simply exit on posix if real shutdown (poweroff) not available
|
||||
PX4_INFO_RAW("Exiting NOW.");
|
||||
#if defined(__SANITIZE_ADDRESS__) || defined(__has_feature) && __has_feature(address_sanitizer)
|
||||
exit(0); // Use exit() instead of _exit() so ASAN can report errors
|
||||
#else
|
||||
system_exit(0);
|
||||
#endif
|
||||
#else
|
||||
PX4_PANIC("board shutdown not available");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user