RFR 8207145 : Native memory leak in WindowsNativeDispatcher

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Jul 12 06:30:48 UTC 2018


Hello!

File: src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
In the native function 
sun.nio.fs.WindowsNativeDispatcher.LookupPrivilegeValue0() a struct of 
type LUID is allocated with LocalAlloc().
If then ::LookupPrivilegeValueW() fails, an exception is thrown, but the 
memory isn't freed.

Moreover, in file 
src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java in 
function enablePrivilege() the result of successful call to 
WindowsNativeDispatcher.LookupPrivilegeValue() isn't freed after use.

Would you please help review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8207145
WEBREV: http://cr.openjdk.java.net/~igerasim/8207145/00/webrev/

Thanks in advance!

-- 
With kind regards,
Ivan Gerasimov



More information about the nio-dev mailing list