diff --git a/src/highlevelcrypto.py b/src/highlevelcrypto.py index 356cded7..7037bfab 100644 --- a/src/highlevelcrypto.py +++ b/src/highlevelcrypto.py @@ -134,9 +134,6 @@ def pointMult(secret): mb = OpenSSL.create_string_buffer(size) OpenSSL.i2o_ECPublicKey(k, OpenSSL.byref(OpenSSL.pointer(mb))) - OpenSSL.EC_POINT_free(pub_key) - OpenSSL.BN_free(priv_key) - OpenSSL.EC_KEY_free(k) return mb.raw except Exception: @@ -144,3 +141,7 @@ def pointMult(secret): import time traceback.print_exc() time.sleep(0.2) + finally: + OpenSSL.EC_POINT_free(pub_key) + OpenSSL.BN_free(priv_key) + OpenSSL.EC_KEY_free(k)