On Fri, 19 Mar 2021 20:36:57 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
> If `JNU_NewStringPlatform` fails to allocate new Java String object for > printer name, `std::bad_alloc` is thrown. The handler for the exception does > not release the local reference to the `nameArray`, thus it will be leaked. src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp line 178: > 176: } catch (std::bad_alloc&) { > 177: delete [] pPrinterEnum; > 178: if (nameArray != NULL) { Not sure that we usually clean the local refs in the native JNI methods, that only required in the native loop which are never returned to the java(I have check that by the grep of env->NewObjectArray) ------------- PR: https://git.openjdk.java.net/jdk/pull/3096