Fix leaks in _set_asn1_time and set_serial_number
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py
index 2852fd1..13f2d56 100644
--- a/OpenSSL/crypto.py
+++ b/OpenSSL/crypto.py
@@ -41,7 +41,7 @@
set_result = _api.ASN1_GENERALIZEDTIME_set_string(
_api.cast('ASN1_GENERALIZEDTIME*', boundary), when)
if set_result == 0:
- dummy = _api.ASN1_STRING_new()
+ dummy = _api.ffi.gc(_api.ASN1_STRING_new(), _api.ASN1_STRING_free)
_api.ASN1_STRING_set(dummy, when, len(when))
check_result = _api.ASN1_GENERALIZEDTIME_check(
_api.cast('ASN1_GENERALIZEDTIME*', dummy))
@@ -763,6 +763,7 @@
if asn1_serial == _api.NULL:
# TODO Not tested
_raise_current_error()
+ asn1_serial = _api.ffi.gc(asn1_serial, _api.ASN1_INTEGER_free)
set_result = _api.X509_set_serialNumber(self._x509, asn1_serial)
if not set_result:
# TODO Not tested