fix memory leak when receive SIGSEGV or SIGABRT