From 92241410b5b0591d849443b3023992334a4be0a2 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 11 Apr 2019 20:57:13 +0800 Subject: fix a memory leak in AIA parsing (#4836) * fix a memory leak in AIA parsing * oops can't remove that --- tests/hazmat/backends/test_openssl_memleak.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/hazmat/backends/test_openssl_memleak.py b/tests/hazmat/backends/test_openssl_memleak.py index ed22b5db..f9ae1c46 100644 --- a/tests/hazmat/backends/test_openssl_memleak.py +++ b/tests/hazmat/backends/test_openssl_memleak.py @@ -210,7 +210,7 @@ class TestOpenSSLMemoryLeaks(object): @pytest.mark.parametrize("path", [ "x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt", ]) - def test_x509_certificate_extensions(self, path): + def test_der_x509_certificate_extensions(self, path): assert_no_memory_leaks(textwrap.dedent(""" def func(path): from cryptography import x509 @@ -226,6 +226,25 @@ class TestOpenSSLMemoryLeaks(object): cert.extensions """), [path]) + @pytest.mark.parametrize("path", [ + "x509/cryptography.io.pem", + ]) + def test_pem_x509_certificate_extensions(self, path): + assert_no_memory_leaks(textwrap.dedent(""" + def func(path): + from cryptography import x509 + from cryptography.hazmat.backends.openssl import backend + + import cryptography_vectors + + with cryptography_vectors.open_vector_file(path, "rb") as f: + cert = x509.load_pem_x509_certificate( + f.read(), backend + ) + + cert.extensions + """), [path]) + def test_x509_csr_extensions(self): assert_no_memory_leaks(textwrap.dedent(""" def func(): -- cgit v1.2.3