On Tue, 22 Jul 2025 08:32:06 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> This is reported by the gcc static analyzer (-fanalyzer); it is just test 
>> coding so not very critical but probably should still be adjusted .
>> 
>> 
>> /jdk/test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c:74:12:
>>  warning: leak of 'str' [CWE-401] [-Wanalyzer-malloc-leak]
>>    74 | return JNU_NewStringPlatform(env, str);
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Adjust Java_StringPlatformChars_newString

test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c line 67:

> 65:     str = (char*)malloc(len + 1);
> 66:     if (str == NULL) {
> 67:         return NULL;

Six of one, half-dozen of the other.  
You'll need to ReleasePrimitiveArrayCritical here or revert to the previous 
version.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26415#discussion_r2222560525

Reply via email to