On Tue, 24 Nov 2026 08:50:21 GMT, Matthias Baesken <[email protected]> wrote:
>> We miss a couple of CFRelease calls in >> Java_apple_security_KeychainStore__1addItemToKeychain in case of early >> errors/returns. >> Also a NULL check after CFDataCreate is recommended. >> See >> https://developer.apple.com/documentation/corefoundation/cfdatacreate(_:_:_:) >> about return value and ownership/Create rule. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Matthias Baesken has updated the pull request incrementally with one > additional commit since the last revision: > > Move rawData declaration other question https://github.com/openjdk/jdk/blob/e289c72d86c1b8ed541b582d7014521d50e8e0a7/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m#L356 In case the Java method jm_createKeyEntry throws / exception check is successful (*env)->CallVoidMethod(env, keyStore, jm_createKeyEntry, alias, creationDate, nativeKeyRef, certRefArray, javaCertArray); if ((*env)->ExceptionCheck(env)) { // <--- maybe add CFRelease(privateKeyRef) ? goto errOut; } should we CFRelease(privateKeyRef) ? It went to the Java layer, but as far as I can see it would not be stored for later release because of the exception. Or do we need more sophisticated checking? Or can we live with an unlikely leak ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/33999#issuecomment-7167339778
