Skip to content

Commit

Permalink
ASAN: Set the options by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 22, 2024
1 parent adcd3c3 commit b13a8ba
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions trunk/src/kernel/srs_kernel_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,22 @@ void asan_report_callback(const char* str)
}
#endif

#ifdef SRS_SANITIZER
// This function return the default options for asan, before main() is called,
// see https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags
//
// Disable halt on errors by halt_on_error, only print messages, note that it still quit for fatal errors,
// see https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
//
// Disable the memory leaking detect for daemon by detect_leaks,
// see https://github.com/google/sanitizers/wiki/SanitizerCommonFlags
//
// Also disable alloc_dealloc_mismatch for gdb.
extern "C" const char *__asan_default_options() {
return "halt_on_error=0:detect_leaks=0:alloc_dealloc_mismatch=0";
}
#endif

bool srs_is_system_control_error(srs_error_t err)
{
int error_code = srs_error_code(err);
Expand Down

0 comments on commit b13a8ba

Please sign in to comment.