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;
}
protected synchronized void clearObjectState() {
this.ssl = null;
this.session = null;
this.params = null;
this.authStore = null;
}
@SuppressWarnings("deprecation")
@Override
protected synchronized void finalize() throws Throwable {

View File

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