free native WOLFSSL when WolfSSLSocket is closed, earlier than finalize
parent
30e7ec6f03
commit
cda657839b
|
@ -1371,6 +1371,12 @@ public class WolfSSLSocket extends SSLSocket {
|
||||||
|
|
||||||
synchronized (handshakeLock) {
|
synchronized (handshakeLock) {
|
||||||
this.connectionClosed = true;
|
this.connectionClosed = true;
|
||||||
|
|
||||||
|
/* Connection is closed, free native WOLFSSL session
|
||||||
|
* to release native memory earlier than garbage collector
|
||||||
|
* might with finalize(). */
|
||||||
|
this.ssl.freeSSL();
|
||||||
|
this.ssl = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1396,6 +1402,8 @@ public class WolfSSLSocket extends SSLSocket {
|
||||||
|
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
|
} catch (WolfSSLJNIException jnie) {
|
||||||
|
throw new IOException(jnie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue