RFR: 8303070: Memory leak in DCmdArgument<char*>::parse_value [v2]

David Holmes dholmes at openjdk.org
Fri Feb 24 23:14:06 UTC 2023


On Fri, 24 Feb 2023 15:51:36 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/services/diagnosticArgument.cpp line 183:
>> 
>>> 181: template <> void DCmdArgument<char*>::parse_value(const char* str,
>>> 182:                                                   size_t len, TRAPS) {
>>> 183:   if (str == nullptr) {
>> 
>> Do we need to call free here? Not sure if str is actually ever null in practice.
>
> I have the same question.  Why don't we call free if _value is non-null?

Not sure str can ever actually be null here, but if it is then yes we should also free. Thanks for catching that.

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

PR: https://git.openjdk.org/jdk/pull/12737


More information about the hotspot-runtime-dev mailing list