RFR: JDK-8292595: jdwp utf_util getWideString might leak memory

Matthias Baesken mbaesken at openjdk.org
Tue Aug 23 12:55:25 UTC 2022


On Thu, 18 Aug 2022 11:51:52 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> There seems to be a case where utf_util.c getWideString might leak memory in an early return.

In case of failing getWideString, we have already a fallback in place that is just copying bytes :

    wstr = getWideString(CP_UTF8, (char*)utf8, len, &wlen);
    if ( wstr == NULL ) {
        // Can't allocate WIDE string
        goto just_copy_bytes;
    }

So in these cases it is probably not needed to abort the VM, because fallback code exists anyway.
So should we add the free, and replace UTF_ERROR  by something like UTF_WARNING (thats just prints the problem - message without abort) ?

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

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


More information about the serviceability-dev mailing list