On Tue, 28 Jul 2026 08:24:21 GMT, Matthias Baesken <[email protected]> wrote:

>> When building a product build with additionally enabled unused initialized 
>> variables warnings (e.g. C4189 MSVC warning) we get some warnings/errors in 
>> libj2pkcs11 because of variables only used in debug code.
>> This can and should be avoided.
>> 
>> ---------
>> - [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 declarations

> Btw. should we better add a free(iList) ? ...

Agree; maybe also checking the result of `malloc`.


if (iList == NULL) {
    TRACE0("Connect: error allocating interface list\n");
}

src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c line 126:

> 124: #ifdef DEBUG
> 125:     CK_ULONG ulCount = 0;
> 126:     CK_INTERFACE_PTR iList = NULL;

These two vars can be moved inside `if (C_GetInterfaceList != NULL)` and `if 
(rv == CKR_OK)`, right?

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

PR Review: https://git.openjdk.org/jdk/pull/32028#pullrequestreview-4797266660
PR Review Comment: https://git.openjdk.org/jdk/pull/32028#discussion_r3665525338

Reply via email to