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

Justin King jcking at openjdk.org
Tue Mar 28 14:31:00 UTC 2023


On Mon, 27 Mar 2023 22:33:39 GMT, Dean Long <dlong at openjdk.org> wrote:

>> 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?

Probably. Was just going with previous logic. I moved it to the end now. PTAL

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

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


More information about the hotspot-compiler-dev mailing list