From 7ebb28053b631590a3dc8058e0e0a09ab84789bd Mon Sep 17 00:00:00 2001 From: Morgan Chen Date: Fri, 29 Sep 2023 14:16:13 -0700 Subject: [PATCH] Fix a regression of a memory leak in Sessions. (#11802) Co-authored-by: Andrew Heard --- Crashlytics/CHANGELOG.md | 3 +++ FirebasePerformance/CHANGELOG.md | 1 + .../Sources/SessionStartEvent.swift | 17 ++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Crashlytics/CHANGELOG.md b/Crashlytics/CHANGELOG.md index b55b88dc04c..2ae35a5c2f0 100644 --- a/Crashlytics/CHANGELOG.md +++ b/Crashlytics/CHANGELOG.md @@ -1,3 +1,6 @@ +# 10.16.0 +- [fixed] Fixed a memory leak regression when generating session events (#11725). + # 10.12.0 - [changed] Updated `upload-symbols` to version 3.16 with support for new default build settings in Xcode 15 (#11463) - [changed] Re-enabled dSYM uploads for Flutter apps building with `--obfuscate` and updated instructions for de-obfuscating Dart stacktraces diff --git a/FirebasePerformance/CHANGELOG.md b/FirebasePerformance/CHANGELOG.md index 2acbb91fb87..50c6447292a 100644 --- a/FirebasePerformance/CHANGELOG.md +++ b/FirebasePerformance/CHANGELOG.md @@ -1,4 +1,5 @@ # 10.16.0 +- [fixed] Fixed a memory leak regression when generating session events (#11725). - [fixed] Fix Xcode 15 runtime warning (#11821). # 10.12.0 diff --git a/FirebaseSessions/Sources/SessionStartEvent.swift b/FirebaseSessions/Sources/SessionStartEvent.swift index e7327de9f11..c107849a662 100644 --- a/FirebaseSessions/Sources/SessionStartEvent.swift +++ b/FirebaseSessions/Sources/SessionStartEvent.swift @@ -41,6 +41,7 @@ class SessionStartEvent: NSObject, GDTCOREventDataObject { super.init() + // Note: If you add a proto string field here, remember to free it in the deinit. proto.event_type = firebase_appquality_sessions_EventType_SESSION_START proto.session_data.session_id = makeProtoString(sessionInfo.sessionId) proto.session_data.first_session_id = makeProtoString(sessionInfo.firstSessionId) @@ -79,16 +80,18 @@ class SessionStartEvent: NSObject, GDTCOREventDataObject { deinit { let garbage: [UnsafeMutablePointer?] = [ - proto.session_data.session_id, - proto.session_data.first_session_id, - proto.session_data.firebase_installation_id, proto.application_info.app_id, - proto.application_info.session_sdk_version, - proto.application_info.device_model, - proto.application_info.development_platform_name, - proto.application_info.development_platform_version, + proto.application_info.apple_app_info.app_build_version, proto.application_info.apple_app_info.bundle_short_version, proto.application_info.apple_app_info.mcc_mnc, + proto.application_info.development_platform_name, + proto.application_info.development_platform_version, + proto.application_info.device_model, + proto.application_info.os_version, + proto.application_info.session_sdk_version, + proto.session_data.session_id, + proto.session_data.firebase_installation_id, + proto.session_data.first_session_id, ] for pointer in garbage { nanopb_free(pointer)