Move freeing pointers in highlevelcrypto.pointMult() to finally branch

like it's done in pyelliptic.
This commit is contained in:
Lee Miller 2022-06-26 16:01:38 +03:00
parent 0fc5cd5927
commit cdd73f9ac0
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -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)