RFR: 8303809: Dispose context in SPNEGO NegotiatorImpl

Daniel Fuchs dfuchs at openjdk.org
Wed Mar 8 13:57:22 UTC 2023

On Wed, 8 Mar 2023 09:05:19 GMT, Alexey Bakhtin <abakhtin at openjdk.org> wrote:

> This patch fixes a possible native memory leak in case of a custom native GSS provider.
> The actual leak was reported in production.
> sun/security/jgss, sun/security/krb5, sun/net/www/protocol/http jtreg tests are passed

@wangweij it would be good if you (or someone from security libs) could review this PR too

src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java line 525:

> 523:     public void disposeContext() {
> 524:         // do nothing
> 525:     }

It would be good to have some comment explaining the purpose of this method. In particular, it would be good to state when (at which point) it is supposed to be called.
Also hopefully the `AuthenticationInfo` object remain valid and can still be used after `disposeContext` has been called?

src/java.security.jgss/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java line 182:

> 180:                 context.dispose();
> 181:             }
> 182:         }catch (GSSException e) {

Trivially: please add space after `}`


Changes requested by dfuchs (Reviewer).

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

More information about the security-dev mailing list