RFR: JDK-8304684: Memory leak in DirectivesParser::set_option_flag [v2]

Justin King jcking at openjdk.org
Tue Mar 21 20:37:45 UTC 2023


On Tue, 21 Mar 2023 18:16:10 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update based on review
>>   
>>   Signed-off-by: Justin King <jcking at google.com>
>
> src/hotspot/share/compiler/directivesParser.cpp line 350:
> 
>> 348:           set->set_ideal_phase_mask(mask);
>> 349:         }
>> 350:         FREE_C_HEAP_ARRAY(char, s);
> 
> An other way to do this is create local variable `bool valid = true;` and assign `false` to instead of `return false;` on all these branches so that we always reach this line to free array and `return valid;`.

I was going for the path of least change, but I can do that. Done. I am only doing that for string, as I want to deal with only the leak in this change.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13125#discussion_r1143961249


More information about the hotspot-compiler-dev mailing list