RFR: JDK-8304684: Memory leak in DirectivesParser::set_option_flag

Vladimir Kozlov kvn at openjdk.org
Tue Mar 21 18:18:46 UTC 2023


On Tue, 21 Mar 2023 16:53:18 GMT, Justin King <jcking at openjdk.org> wrote:

> Add missing `FREE_C_HEAP_ARRAY` call.

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;`.

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

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


More information about the hotspot-compiler-dev mailing list