On Thu, 18 Aug 2022 12:30:57 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> There seems to be a case where utf_util.c getWideString might leak memory in 
>> an early return.
>
> src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c line 346:
> 
>> 344:     if (MultiByteToWideChar(codePage, 0, str, len, wstr, wlen) == 0) {
>> 345:         UTF_ERROR(("Can't get WIDE string"));
>> 346:         free(wstr);
> 
> Is this really an issue? I thought that UTF_ERROR prints the error and aborts 
> the program.

Hi Alan, yeah I saw  that it prints an error but you are correct it does an 
abort() call too. So probably we can keep this as it is.
Another  MultiByteToWideChar / malloc  case I just saw 
https://github.com/openjdk/jdk/blob/master/src/java.instrument/windows/native/libinstrument/EncodingSupport_md.c#L79
shouldn't there be the free call after line 80 ?

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

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

Reply via email to