Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2849cc3

Browse files
olivielpeauMariatta
authored andcommitted
bpo-29738: Fix memory leak in _get_crl_dp (GH-526)
* 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.
1 parent 0dc5c31 commit 2849cc3

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

Modules/_ssl.c

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

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

12181214
if (dps == NULL)
@@ -1257,9 +1253,7 @@ _get_crl_dp(X509 *certificate) {
12571253

12581254
done:
12591255
Py_XDECREF(lst);
1260-
#if OPENSSL_VERSION_NUMBER < 0x10001000L
1261-
sk_DIST_POINT_free(dps);
1262-
#endif
1256+
CRL_DIST_POINTS_free(dps);
12631257
return res;
12641258
}
12651259

0 commit comments

Comments
 (0)