Author: Alex Gaynor <alex.gay...@gmail.com> Branch: Changeset: r80571:2690aff7d7b0 Date: 2015-11-06 20:54 -0500 http://bitbucket.org/pypy/pypy/changeset/2690aff7d7b0/
Log: issue 2183 -- free sk_DIST_POINT in SSLSocket.getpeerert() diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -968,20 +968,24 @@ if not dps: return None - cdp_w = [] - for i in range(libssl_sk_DIST_POINT_num(dps)): - dp = libssl_sk_DIST_POINT_value(dps, i) - gns = libssl_pypy_DIST_POINT_fullname(dp) + try: + cdp_w = [] + for i in range(libssl_sk_DIST_POINT_num(dps)): + dp = libssl_sk_DIST_POINT_value(dps, i) + gns = libssl_pypy_DIST_POINT_fullname(dp) - for j in range(libssl_sk_GENERAL_NAME_num(gns)): - name = libssl_sk_GENERAL_NAME_value(gns, j) - gntype = intmask(name.c_type) - if gntype != GEN_URI: - continue - uri = libssl_pypy_GENERAL_NAME_uri(name) - length = intmask(uri.c_length) - s_uri = rffi.charpsize2str(uri.c_data, length) - cdp_w.append(space.wrap(s_uri)) + for j in range(libssl_sk_GENERAL_NAME_num(gns)): + name = libssl_sk_GENERAL_NAME_value(gns, j) + gntype = intmask(name.c_type) + if gntype != GEN_URI: + continue + uri = libssl_pypy_GENERAL_NAME_uri(name) + length = intmask(uri.c_length) + s_uri = rffi.charpsize2str(uri.c_data, length) + cdp_w.append(space.wrap(s_uri)) + finally: + if OPENSSL_VERSION_NUMBER < 0x10001000: + libssl_sk_DIST_POINT_free(dps) return space.newtuple(cdp_w[:]) def checkwait(space, w_sock, writing): diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py --- a/rpython/rlib/ropenssl.py +++ b/rpython/rlib/ropenssl.py @@ -452,6 +452,8 @@ macro=True) ssl_external('sk_DIST_POINT_value', [stack_st_DIST_POINT, rffi.INT], DIST_POINT, macro=True) +ssl_external('sk_DIST_POINT_free', [stack_st_DIST_POINT], lltype.Void, + macro=True) ssl_external('pypy_DIST_POINT_fullname', [DIST_POINT], GENERAL_NAMES, macro=True) ssl_external('sk_ACCESS_DESCRIPTION_num', [AUTHORITY_INFO_ACCESS], rffi.INT, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit