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

Dean Long dlong at openjdk.org
Mon Mar 27 22:36:33 UTC 2023


On Mon, 27 Mar 2023 19:57:12 GMT, Justin King <jcking at openjdk.org> wrote:

>> Add missing `FREE_C_HEAP_ARRAY` call.
>
> Justin King has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - Make directives enum macros more fool proof
>    
>    Signed-off-by: Justin King <jcking at google.com>
>  - Fix capitalization
>    
>    Signed-off-by: Justin King <jcking at google.com>
>  - Fix unqualified member variable reference
>    
>    Signed-off-by: Justin King <jcking at google.com>
>  - Update DirectiveSet to take ownership of string options
>    
>    Signed-off-by: Justin King <jcking at google.com>

src/hotspot/share/compiler/directivesParser.cpp line 321:

> 319:         strncpy(s, v->str.start, v->str.length + 1);
> 320:         s[v->str.length] = '\0';
> 321:         (set->*test)((void *)&s);  // Takes ownership.

Would it be better to do the "set" only after validators have passed?

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

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


More information about the hotspot-compiler-dev mailing list