gc the DSA key a different way
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index a6cd263..86752d3 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -221,6 +221,8 @@
if dsa == _ffi.NULL:
# TODO: This is untested.
_raise_current_error()
+
+ dsa = _ffi.gc(dsa, _lib.DSA_free)
res = _lib.DSA_generate_parameters_ex(
dsa, bits, _ffi.NULL, 0, _ffi.NULL, _ffi.NULL, _ffi.NULL
)
@@ -230,7 +232,7 @@
if not _lib.DSA_generate_key(dsa):
# TODO: This is untested.
_raise_current_error()
- if not _lib.EVP_PKEY_assign_DSA(self._pkey, dsa):
+ if not _lib.EVP_PKEY_set1_DSA(self._pkey, dsa):
# TODO: This is untested.
_raise_current_error()
else: