support asan and fix several memory bug

This commit is contained in:
xuhuleon
2021-09-18 21:54:07 +08:00
committed by wangzelin.wzl
parent e4b3157f72
commit 137a8f1f96
10 changed files with 54 additions and 22 deletions

View File

@ -25,16 +25,19 @@ namespace oceanbase {
namespace common {
static const int SIG_SET[] = {SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGURG};
static inline void handler(int sig, siginfo_t* s, void* p)
#ifndef OB_USE_ASAN
static inline void handler(int sig, siginfo_t *s, void *p)
{
if (tl_handler != nullptr) {
tl_handler(sig, s, p);
}
}
#endif
int install_ob_signal_handler()
{
int ret = OB_SUCCESS;
#ifndef OB_USE_ASAN
struct sigaction sa;
sa.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER | SA_ONSTACK;
sa.sa_sigaction = handler;
@ -44,6 +47,7 @@ int install_ob_signal_handler()
ret = OB_INIT_FAIL;
}
}
#endif
return ret;
}