diff --git a/interfaces/innerkits/signal_handler/dfx_signal_handler.c b/interfaces/innerkits/signal_handler/dfx_signal_handler.c index 6e445ffe7eb8ed2320d2a8290a91b4d78ec6324c..80afe7a91d9774f2f75d51eb644d8dfe50c16b94 100644 --- a/interfaces/innerkits/signal_handler/dfx_signal_handler.c +++ b/interfaces/innerkits/signal_handler/dfx_signal_handler.c @@ -229,6 +229,7 @@ static void DFX_UnwindLocal(int sig, siginfo_t *si, void *context) unw_getcontext(&unwContext); if (unw_init_local(&cursor, &unwContext) != 0) { HILOG_WARN(LOG_CORE, "Fail to init local unwind context."); + DestroyProcess(process); return; } diff --git a/tools/process_dump/dfx_unwind_remote.c b/tools/process_dump/dfx_unwind_remote.c index 2152a2b82abf80a9df45c3fde241600c2afadc71..d1783befcf8ed138d6aaac97891b954f99c0bcf7 100644 --- a/tools/process_dump/dfx_unwind_remote.c +++ b/tools/process_dump/dfx_unwind_remote.c @@ -63,6 +63,10 @@ BOOL UnwindThread(DfxProcess *process, DfxThread *thread) unw_addr_space_t as = unw_create_addr_space(&_UPT_accessors, 0); pid_t tid = thread->tid; void *context = _UPT_create(tid); + if (context == NULL) { + DfxLogWarn("Fail to create context for %d.", tid); + return FALSE; + } unw_cursor_t cursor; if (unw_init_remote(&cursor, as, context) != 0) { DfxLogWarn("Fail to init cursor for remote unwind.");