GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OpenSSL: Don't leak OpenSslKeyManagerProvider on exception (#16337) · netty/netty@df79f6b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handler/src/main/java/io/netty/handler/ssl
    • ReferenceCountedOpenSslContext.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java‎

Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,17 @@ static OpenSslKeyMaterialProvider setupSecurityProviderSignatureSource(
11341134
// 2. Set up keyless KeyManagerFactory and certificate callback for certificate provision
11351135
KeyManagerFactory keylessKmf = OpenSslX509KeyManagerFactory.newKeyless(keyCertChain);
11361136
OpenSslKeyMaterialProvider keyMaterialProvider = providerFor(keylessKmf, "");
1137-
1138-
// Set up certificate callback for alternative keys - required for client certificates
1139-
OpenSslKeyMaterialManager materialManager =
1140-
new OpenSslKeyMaterialManager(keyMaterialProvider, thiz.hasTmpDhKeys);
1141-
SSLContext.setCertificateCallback(ctx, toCallback.apply(materialManager));
1142-
return keyMaterialProvider;
1137+
try {
1138+
// Set up certificate callback for alternative keys - required for client certificates
1139+
OpenSslKeyMaterialManager materialManager =
1140+
new OpenSslKeyMaterialManager(keyMaterialProvider, thiz.hasTmpDhKeys);
1141+
SSLContext.setCertificateCallback(ctx, toCallback.apply(materialManager));
1142+
return keyMaterialProvider;
1143+
} catch (Throwable cause) {
1144+
// Destroy the provider in case of failure as otherwise we might leak memory.
1145+
keyMaterialProvider.destroy();
1146+
throw cause;
1147+
}
11431148
}
11441149

11451150
private static ReferenceCountedOpenSslEngine retrieveEngine(Map<Long, ReferenceCountedOpenSslEngine> engines,

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.