diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-07-09 10:18:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 10:18:30 (GMT) |
commit | 90584c02b4dcfc087bee5e4131b7ba72b669d58a (patch) | |
tree | d66ef7465f44c442b519933d6e48a0bed63a649a /Modules/_ssl.c | |
parent | e68978978f49cfc489fa0f888281ce84460818c0 (diff) | |
download | cpython-90584c02b4dcfc087bee5e4131b7ba72b669d58a.zip cpython-90584c02b4dcfc087bee5e4131b7ba72b669d58a.tar.gz cpython-90584c02b4dcfc087bee5e4131b7ba72b669d58a.tar.bz2 |
bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() (GH-21407)
(cherry picked from commit ee96f32ca24779656d3c8736d26671fc3689f0a3)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5806417..a8c339d 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -4545,11 +4545,12 @@ _servername_callback(SSL *s, int *al, void *args) * back into a str object, but still as an A-label (bpo-28414) */ servername_str = PyUnicode_FromEncodedObject(servername_bytes, "ascii", NULL); - Py_DECREF(servername_bytes); if (servername_str == NULL) { PyErr_WriteUnraisable(servername_bytes); + Py_DECREF(servername_bytes); goto error; } + Py_DECREF(servername_bytes); result = PyObject_CallFunctionObjArgs( ssl_ctx->set_sni_cb, ssl_socket, servername_str, ssl_ctx, NULL); |