Skip to content

Commit

Permalink
Fix a regression of a memory leak in Sessions. (#11802)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Heard <[email protected]>
  • Loading branch information
morganchen12 and andrewheard authored Sep 29, 2023
1 parent a49058e commit 7ebb280
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions FirebasePerformance/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 10 additions & 7 deletions FirebaseSessions/Sources/SessionStartEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -79,16 +80,18 @@ class SessionStartEvent: NSObject, GDTCOREventDataObject {

deinit {
let garbage: [UnsafeMutablePointer<pb_bytes_array_t>?] = [
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)
Expand Down

0 comments on commit 7ebb280

Please sign in to comment.