diff -r 13550b3ca1a6 Modules/_ssl.c --- a/Modules/_ssl.c Sat Nov 07 10:08:53 2015 -0800 +++ b/Modules/_ssl.c Sat Nov 07 15:53:06 2015 -0500 @@ -1064,6 +1064,12 @@ return NULL; } +#if OPENSSL_VERSION_NUMBER < 0x10001000L + #define FREE_DISTRIBUTION_POINTS(param) sk_DIST_POINT_free(param) +#else + #define FREE_DISTRIBUTION_POINTS(param) +#endif + static PyObject * _get_crl_dp(X509 *certificate) { STACK_OF(DIST_POINT) *dps; @@ -1084,6 +1090,7 @@ } if ((lst = PyList_New(0)) == NULL) { + FREE_DISTRIBUTION_POINTS(dps); return NULL; } @@ -1108,12 +1115,14 @@ uri->length); if (ouri == NULL) { Py_DECREF(lst); + FREE_DISTRIBUTION_POINTS(dps); return NULL; } result = PyList_Append(lst, ouri); Py_DECREF(ouri); if (result < 0) { Py_DECREF(lst); + FREE_DISTRIBUTION_POINTS(dps); return NULL; } } @@ -1121,11 +1130,13 @@ /* convert to tuple or None */ if (PyList_Size(lst) == 0) { Py_DECREF(lst); + FREE_DISTRIBUTION_POINTS(dps); return Py_None; } else { PyObject *tup; tup = PyList_AsTuple(lst); Py_DECREF(lst); + FREE_DISTRIBUTION_POINTS(dps); return tup; } }