Skip to content

Commit

Permalink
fix: move event free to exit block
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Feb 16, 2021
1 parent 169c5fb commit 900bc2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* Check additional JNI calls for pending exceptions and no-op
[#1142](https://github.com/bugsnag/bugsnag-android/pull/1142)
* Move free() call to exit block
[#1140](https://github.com/bugsnag/bugsnag-android/pull/1140)

## 5.6.2 (2021-02-15)

Expand Down
4 changes: 3 additions & 1 deletion bugsnag-plugin-android-ndk/src/main/jni/bugsnag_ndk.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ Java_com_bugsnag_android_ndk_NativeBridge_deliverReportAtPath(
} else {
BUGSNAG_LOG("Failed to serialize event as JSON: %s", event_path);
}
free(event);
} else {
BUGSNAG_LOG("Failed to read event at file: %s", event_path);
}
Expand All @@ -209,6 +208,9 @@ Java_com_bugsnag_android_ndk_NativeBridge_deliverReportAtPath(

exit:
pthread_mutex_unlock(&bsg_native_delivery_mutex);
if (event != NULL) {
free(event);
}
bsg_safe_release_byte_array_elements(env, jpayload, (jbyte *)payload);
if (payload != NULL) {
free(payload);
Expand Down

0 comments on commit 900bc2f

Please sign in to comment.