Skip to content

Commit 8e72013

Browse files
authored
[3.6] bpo-29738: Fix memory leak in _get_crl_dp (GH-526) (GH-1142)
* 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 2e30eb6 commit 8e72013

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
@@ -1210,10 +1210,6 @@ _get_crl_dp(X509 *certificate) {
12101210
int i, j;
12111211
PyObject *lst, *res = NULL;
12121212

1213-
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
1214-
/* Calls x509v3_cache_extensions and sets up crldp */
1215-
X509_check_ca(certificate);
1216-
#endif
12171213
dps = X509_get_ext_d2i(certificate, NID_crl_distribution_points, NULL, NULL);
12181214

12191215
if (dps == NULL)
@@ -1258,9 +1254,7 @@ _get_crl_dp(X509 *certificate) {
12581254

12591255
done:
12601256
Py_XDECREF(lst);
1261-
#if OPENSSL_VERSION_NUMBER < 0x10001000L
1262-
sk_DIST_POINT_free(dps);
1263-
#endif
1257+
CRL_DIST_POINTS_free(dps);
12641258
return res;
12651259
}
12661260

0 commit comments

Comments
 (0)