JSSE: release WolfSSLEngineHelper state from WolfSSLSocket when SSLSocket.close() is called

pull/189/head
Chris Conlon 2024-04-18 17:12:24 -06:00
parent a7c1830b0e
commit 65e4191ba4
2 changed files with 13 additions and 0 deletions

View File

@ -1390,6 +1390,13 @@ public class WolfSSLEngineHelper {
return WolfSSL.SSL_FAILURE; return WolfSSL.SSL_FAILURE;
} }
protected synchronized void clearObjectState() {
this.ssl = null;
this.session = null;
this.params = null;
this.authStore = null;
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
protected synchronized void finalize() throws Throwable { protected synchronized void finalize() throws Throwable {

View File

@ -1909,6 +1909,10 @@ public class WolfSSLSocket extends SSLSocket {
this.ssl.freeSSL(); this.ssl.freeSSL();
this.ssl = null; this.ssl = null;
/* Reset internal WolfSSLEngineHelper to null */
this.EngineHelper.clearObjectState();
this.EngineHelper = null;
/* Release Input/OutputStream objects */ /* Release Input/OutputStream objects */
if (this.inStream != null) { if (this.inStream != null) {
this.inStream.close(); this.inStream.close();
@ -2080,6 +2084,8 @@ public class WolfSSLSocket extends SSLSocket {
} }
this.ssl.freeSSL(); this.ssl.freeSSL();
this.ssl = null; this.ssl = null;
this.EngineHelper = null;
this.params = null;
} }
super.finalize(); super.finalize();
} }