RFR: 8303809: Dispose context in SPNEGO NegotiatorImpl

Weijun Wang weijun at openjdk.org
Fri Mar 10 15:09:21 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

src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java line 254:

> 252:             try {
> 253:                 negotiator.disposeContext();
> 254:             }catch(IOException ioEx) {

Please add a space before `catch`.

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

> 132:             } catch(Exception ex) {
> 133:                 //dispose context silently
> 134:             }

Why is this cleanup necessary here but not in `nextToken()`? If we don't do any cleanup here, will `disposeContext()` be called inside `HttpURLConnection`?

-------------

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


More information about the security-dev mailing list