diff --git a/src/java/com/wolfssl/WolfSSLCertManager.java b/src/java/com/wolfssl/WolfSSLCertManager.java index 5a1516b..ee76c46 100644 --- a/src/java/com/wolfssl/WolfSSLCertManager.java +++ b/src/java/com/wolfssl/WolfSSLCertManager.java @@ -87,4 +87,16 @@ public class WolfSSLCertManager { /* free Java resources */ this.active = false; } + + @SuppressWarnings("deprecation") + @Override + protected void finalize() throws Throwable + { + if (this.active == true) { + /* free resources, set state */ + this.free(); + this.active = false; + } + super.finalize(); + } } diff --git a/src/java/com/wolfssl/WolfSSLCertificate.java b/src/java/com/wolfssl/WolfSSLCertificate.java index badcbbd..7abedae 100644 --- a/src/java/com/wolfssl/WolfSSLCertificate.java +++ b/src/java/com/wolfssl/WolfSSLCertificate.java @@ -391,4 +391,16 @@ public class WolfSSLCertificate { /* free Java resources */ this.active = false; } + + @SuppressWarnings("deprecation") + @Override + protected void finalize() throws Throwable + { + if (this.active == true) { + /* free resources, set state */ + this.free(); + this.active = false; + } + super.finalize(); + } }