Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential memory leak when attestation delegate is set #24906

Merged
merged 1 commit into from
Feb 8, 2023
Merged

Fix potential memory leak when attestation delegate is set #24906

merged 1 commit into from
Feb 8, 2023

Conversation

yufengwangca
Copy link
Contributor

@yufengwangca yufengwangca commented Feb 7, 2023

  1. When we call into the Java VM from native code, so there is no Java VM do the garbage collection to release the reference object
 jclass deviceAttestationDelegateCls = nullptr;
        JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/DeviceAttestationDelegate",
                                                 deviceAttestationDelegateCls);

We need to manually release the reference object deviceAttestationDelegateCls when we're done with it.

  1. Based on the Java interface design, attestationInfo should be set to null if errorCode is 0
   * @param devicePtr Handle of device being commissioned
   * @param attestationInfo Attestation information for the device, null is errorCode is 0.
   * @param errorCode Error code on attestation failure. 0 if succeed.
   */
  void onDeviceAttestationCompleted(long devicePtr, AttestationInfo attestationInfo, int errorCode);

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

PR #24906: Size comparison from 062b770 to 8d020d2

Decreases (1 build for qpg)
platform target config section 062b770 8d020d2 change % change
qpg lighting-app qpg6105+debug (read/write) 1148244 1148236 -8 -0.0
.text 595344 595336 -8 -0.0
Full report (4 builds for cc32xx, mbed, qpg)
platform target config section 062b770 8d020d2 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 639725 639725 0 0.0
(read/write) 204084 204084 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197488 197488 0 0.0
.comment 194 194 0 0.0
.data 1476 1476 0 0.0
.debug_abbrev 928401 928401 0 0.0
.debug_aranges 87336 87336 0 0.0
.debug_frame 299792 299792 0 0.0
.debug_info 19915393 19915393 0 0.0
.debug_line 2646819 2646819 0 0.0
.debug_loc 2781044 2781044 0 0.0
.debug_ranges 280656 280656 0 0.0
.debug_str 2978585 2978585 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105269 105269 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 375623 375623 0 0.0
.symtab 255664 255664 0 0.0
.text 532332 532332 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2464072 2464072 0 0.0
.bss 215892 215892 0 0.0
.data 5880 5880 0 0.0
.text 1426716 1426716 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1148244 1148236 -8 -0.0
.bss 99876 99876 0 0.0
.data 848 848 0 0.0
.text 595344 595336 -8 -0.0
lock-app qpg6105+debug (read/write) 1116220 1116220 0 0.0
.bss 96396 96396 0 0.0
.data 860 860 0 0.0
.text 563316 563316 0 0.0

@yufengwangca yufengwangca enabled auto-merge (squash) February 8, 2023 15:54
@yufengwangca yufengwangca merged commit 6f0ae9d into project-chip:master Feb 8, 2023
lpbeliveau-silabs pushed a commit to lpbeliveau-silabs/connectedhomeip that referenced this pull request Feb 13, 2023
lecndav pushed a commit to lecndav/connectedhomeip that referenced this pull request Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants