From ff1f720dcbbfa12aa6b8cb1575ec4832c9c6685a Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 12 May 2021 17:28:42 +0200 Subject: [PATCH] bpo-40645: Fix reference leaks in the _hashopenssl initialization The PyModule_AddObjectRef function doesn't steal a reference, so an extra Py_DECREF is needed. --- Modules/_hashopenssl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index b2c67759e95ea3..13634a579f0ddb 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -2109,6 +2109,7 @@ hashlib_init_constructors(PyObject *module) if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) { return -1; } + Py_DECREF(proxy); return 0; }