RFR: 8284490: Remove finalizer method in java.security.jgss [v3]
Weijun Wang
weijun at openjdk.java.net
Sat Apr 9 15:03:40 UTC 2022
On Sat, 9 Apr 2022 06:22:51 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
> Could you have more details? I did not catch the comment about NativeGSSContext.
When `NativeGSSContext(GSSNameElement peer, GSSCredElement myCred, int time, GSSLibStub stub)` is called, `pContext` is 0 and you haven't registered the cleaner. Later, when `initSecContext()` is called, it calls into `cStub.initContext()` and this native method will set `pContext` if a context is established. Since you haven't registered the cleaner in the ctor, this native context will not be released at the end.
So one solution is to add a `setNativeContext(long pContext)` method and when this method is called you register the cleaner. Now, inside the native method, instead of setting the `pContext` field directly you can call this setter method.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8136
More information about the security-dev
mailing list