diff --git a/CHANGELOG.md b/CHANGELOG.md index abb7e8896..6f6c1d17f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## TBD + +### Bug fixes + +* Fix use-after-free in `notify()` logic which could lead to a deadlock + [#420](https://github.com/bugsnag/bugsnag-cocoa/pull/420) + ## 5.22.7 (2019-10-03) ### Bug fixes diff --git a/Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_User.c b/Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_User.c index 4e1ba2fde..31e4e5db4 100644 --- a/Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_User.c +++ b/Source/KSCrash/Source/KSCrash/Recording/Sentry/BSG_KSCrashSentry_User.c @@ -143,8 +143,6 @@ void bsg_kscrashsentry_reportUserException(const char *name, char severityChar = severity != NULL && strlen(severity) > 0 ? severity[0] : 'w'; localContext->onCrash(severityChar, errorClass, reportContext); - bsg_kscrashsentry_freeReportContext(reportContext); - if (terminateProgram) { bsg_kscrashsentry_uninstall(BSG_KSCrashTypeAll); bsg_kscrashsentry_resumeThreads(); @@ -155,5 +153,7 @@ void bsg_kscrashsentry_reportUserException(const char *name, if (localContext->suspendThreadsForUserReported) { pthread_mutex_unlock(&bsg_suspend_threads_mutex); } + + bsg_kscrashsentry_freeReportContext(reportContext); } }