On Fri, 20 Nov 2026 13:05:25 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).

src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m line 794:

> 792:                 passwordChars = (*env)->GetCharArrayElements(env, 
> passwordObj, NULL);
> 793:                 if (passwordChars == NULL) {
> 794:                     CFRelease(cfDataToImport);

Can we instead move all password-related code to the beginning of the `@try` 
block?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/33999#discussion_r4649608400

Reply via email to