Skip to content

Commit b2b00e0

Browse files
authored
[2.7] bpo-29738: Fix memory leak in _get_crl_dp (GH-526) (GH-1144)
* Remove conditional on free of `dps`, since `dps` is now allocated for all versions of OpenSSL * Remove call to `x509_check_ca` since it was only used to cache the `crldp` field of the certificate CRL_DIST_POINTS_free is available in all supported versions of OpenSSL (recent 0.9.8+) and LibreSSL. (cherry picked from commit 2849cc3)
1 parent 53ad684 commit b2b00e0

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Modules/_ssl.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,6 @@ _get_crl_dp(X509 *certificate) {
11251125
int i, j;
11261126
PyObject *lst, *res = NULL;
11271127

1128-
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
1129-
/* Calls x509v3_cache_extensions and sets up crldp */
1130-
X509_check_ca(certificate);
1131-
#endif
11321128
dps = X509_get_ext_d2i(certificate, NID_crl_distribution_points, NULL, NULL);
11331129

11341130
if (dps == NULL)
@@ -1173,9 +1169,7 @@ _get_crl_dp(X509 *certificate) {
11731169

11741170
done:
11751171
Py_XDECREF(lst);
1176-
#if OPENSSL_VERSION_NUMBER < 0x10001000L
1177-
sk_DIST_POINT_free(dps);
1178-
#endif
1172+
CRL_DIST_POINTS_free(dps);
11791173
return res;
11801174
}
11811175

0 commit comments

Comments
 (0)