Extension Modules
-----------------
+- Issue #15977: Fix memory leak in Modules/_ssl.c when the function
+ _set_npn_protocols() is called multiple times, thanks to Daniel Sommermann.
+
Tests
-----
return NULL;
}
self->ctx = ctx;
+#ifdef OPENSSL_NPN_NEGOTIATED
+ self->npn_protocols = NULL;
+#endif
/* Defaults */
SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL);
SSL_CTX_set_options(self->ctx,
if (!PyArg_ParseTuple(args, "y*:set_npn_protocols", &protos))
return NULL;
+ if (self->npn_protocols != NULL) {
+ PyMem_Free(self->npn_protocols);
+ }
+
self->npn_protocols = PyMem_Malloc(protos.len);
if (self->npn_protocols == NULL) {
PyBuffer_Release(&protos);