summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2020-08-02 15:48:30 -0500
committerGitHub <noreply@github.com>2020-08-02 16:48:30 -0400
commit80a4ce7b9ddf285b7a75209dd4f01586ed76a8d6 (patch)
treef98c514f3d6b7559beac44fe8fd0dd51b31ba018 /src
parentd9c821eaf9f6d0816802736eda88086ac98a9d66 (diff)
downloadcryptography-80a4ce7b9ddf285b7a75209dd4f01586ed76a8d6.tar.gz
check if a value is null before we gc (#5369)
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index e76d7bb5a..e455c1821 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -2480,8 +2480,8 @@ class Backend(object):
num = self._lib.sk_X509_num(sk_x509_ptr[0])
for i in range(num):
x509 = self._lib.sk_X509_value(sk_x509, i)
- x509 = self._ffi.gc(x509, self._lib.X509_free)
self.openssl_assert(x509 != self._ffi.NULL)
+ x509 = self._ffi.gc(x509, self._lib.X509_free)
additional_certificates.append(_Certificate(self, x509))
return (key, cert, additional_certificates)