RFR: 8361959: [GCC static analyzer] java_props_md.c leak of 'temp' variable is reported [v2]
Roger Riggs
rriggs at openjdk.org
Mon Jul 14 17:16:40 UTC 2025
On Sat, 12 Jul 2025 17:36:54 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
>> The following is reported when building with the gcc static analyzer (-fanalyzer) :
>>
>>
>> /jdk/src/java.base/unix/native/libjava/java_props_md.c:244:17: warning: leak of 'temp' [CWE-401] [-Wanalyzer-malloc-leak]
>> 244 | return 0;
>>
>>
>> Seems we have to free temp in an early return.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>
> free before another early return
Looks good.
(temp doesn't look like a temporary since its used throughout the function.
And all the other locals have useful names.)
-------------
Marked as reviewed by rriggs (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26264#pullrequestreview-3017138764
More information about the core-libs-dev
mailing list