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); ------------- Commit messages: - JDK-8362889 Changes: https://git.openjdk.org/jdk/pull/26415/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26415&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8362889 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26415.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26415/head:pull/26415 PR: https://git.openjdk.org/jdk/pull/26415