RFR [XS] : 8213366: (fs) avoid handle leak in Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstFile0
Baesken, Matthias
matthias.baesken at sap.com
Mon Nov 5 11:44:02 UTC 2018
Hello, please review this small fix.
It adjusts
Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstFile0
In file src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c .
In this function a Handle "handle" is acquired by calling FindFirstFileW .
However we have an early return in the function, and in this special case we miss to close the handle with FindClose .
More info on FindFirstFileW :
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilew
( states : When the search handle is no longer needed, close it by using the FindClose<https://msdn.microsoft.com/64b3bc49-1e0e-4572-9d9f-936c45f5b01c> function, not CloseHandle<https://msdn.microsoft.com/9b84891d-62ca-4ddc-97b7-c4c79482abd9>. )
Bug/webrev :
https://bugs.openjdk.java.net/browse/JDK-8213366
http://cr.openjdk.java.net/~mbaesken/webrevs/8213366.0/webrev/
Best regards, Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20181105/0019a4f6/attachment.html>
More information about the nio-dev
mailing list