aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-02-04 22:24:07 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2018-02-04 09:24:07 -0500
commit1fdf29e6e0575e7976c68a6245fa217f6d611752 (patch)
treef98638feea5d935365f9136c1c3ccd6937af68ea /src
parentfc2ad04b46129806b8261caff8e7260675a2d33d (diff)
downloadcryptography-1fdf29e6e0575e7976c68a6245fa217f6d611752.tar.gz
cryptography-1fdf29e6e0575e7976c68a6245fa217f6d611752.tar.bz2
cryptography-1fdf29e6e0575e7976c68a6245fa217f6d611752.zip
fix a memory leak in ec derive_private_key (#4096)
* fix a memory leak in ec derive_private_key fixes #4095 * pep8!
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index ebcf8015..85e13b57 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -1409,8 +1409,9 @@ class Backend(object):
res = self._lib.EC_KEY_set_public_key(ec_cdata, point)
self.openssl_assert(res == 1)
- res = self._lib.EC_KEY_set_private_key(
- ec_cdata, self._int_to_bn(private_value))
+ private = self._int_to_bn(private_value)
+ private = self._ffi.gc(private, self._lib.BN_clear_free)
+ res = self._lib.EC_KEY_set_private_key(ec_cdata, private)
self.openssl_assert(res == 1)
evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)