Skip to content

Commit 80a1a78

Browse files
committed
Guard crashed thread handle before closing
1 parent 752617c commit 80a1a78

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backends/native/sentry_crash_daemon.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,10 @@ enumerate_threads_from_process(sentry_crash_context_t *ctx)
16421642
// Retrieve the name for the crashed thread (index 0)
16431643
HANDLE hCrashedThread
16441644
= OpenThread(THREAD_QUERY_LIMITED_INFORMATION, FALSE, crashed_tid);
1645-
get_thread_name(hCrashedThread, &ctx->platform.threads[0]);
1646-
CloseHandle(hCrashedThread);
1645+
if (hCrashedThread != NULL) {
1646+
get_thread_name(hCrashedThread, &ctx->platform.threads[0]);
1647+
CloseHandle(hCrashedThread);
1648+
}
16471649

16481650
SENTRY_DEBUGF(
16491651
"enumerate_threads: start, crashed_tid=%lu, threads[0].id=%lu",

0 commit comments

Comments
 (0)