mirror of
https://github.com/python/cpython.git
synced 2025-10-06 07:02:33 +00:00
bpo-31095: fix potential crash during GC (GH-2974)
This commit is contained in:
parent
bf9075a0c5
commit
a6296d34a4
14 changed files with 60 additions and 13 deletions
|
@ -2778,6 +2778,8 @@ context_clear(PySSLContext *self)
|
|||
static void
|
||||
context_dealloc(PySSLContext *self)
|
||||
{
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(self);
|
||||
context_clear(self);
|
||||
SSL_CTX_free(self->ctx);
|
||||
#ifdef OPENSSL_NPN_NEGOTIATED
|
||||
|
@ -4292,6 +4294,7 @@ static PyTypeObject PySSLMemoryBIO_Type = {
|
|||
static void
|
||||
PySSLSession_dealloc(PySSLSession *self)
|
||||
{
|
||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||
PyObject_GC_UnTrack(self);
|
||||
Py_XDECREF(self->ctx);
|
||||
if (self->session != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue