aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-12 11:09:28 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-12 11:09:28 -0400
commit4a704e07c61f7658c4c95befac0b1fc0d1aaf315 (patch)
treec277bb1f095ff7af89f51f845c9918ea25219014
parent5508ee2b447f7cfcab619a309e4f370ff59ce9c7 (diff)
downloadcryptography-4a704e07c61f7658c4c95befac0b1fc0d1aaf315.tar.gz
cryptography-4a704e07c61f7658c4c95befac0b1fc0d1aaf315.tar.bz2
cryptography-4a704e07c61f7658c4c95befac0b1fc0d1aaf315.zip
free the bit string
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py3
-rw-r--r--src/cryptography/hazmat/bindings/openssl/asn1.py1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 13f57e84..57e6146b 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -229,6 +229,9 @@ class _Certificate(object):
bit_string = self._backend._lib.X509V3_EXT_d2i(ext)
assert bit_string != self._backend._ffi.NULL
bit_string = self._backend._ffi.cast("ASN1_BIT_STRING *", bit_string)
+ bit_string = self._backend._ffi.gc(
+ bit_string, self._backend._lib.ASN1_BIT_STRING_free
+ )
get_bit = self._backend._lib.ASN1_BIT_STRING_get_bit
digital_signature = get_bit(bit_string, 0) == 1
content_commitment = get_bit(bit_string, 1) == 1
diff --git a/src/cryptography/hazmat/bindings/openssl/asn1.py b/src/cryptography/hazmat/bindings/openssl/asn1.py
index 45dfe758..475bd052 100644
--- a/src/cryptography/hazmat/bindings/openssl/asn1.py
+++ b/src/cryptography/hazmat/bindings/openssl/asn1.py
@@ -120,6 +120,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *, int, int);
"""
MACROS = """
+void ASN1_BIT_STRING_free(ASN1_BIT_STRING *);
/* This is not a macro, but is const on some versions of OpenSSL */
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *, int);
ASN1_TIME *M_ASN1_TIME_dup(void *);