From 3611db53f5b854cb6d01ee5ebb5e11c87bcc2df5 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 12 May 2021 18:04:34 +0200 Subject: [PATCH] bpo-40645: Fix reference leak in the _hashopenssl extension (GH-26072) The `PyModule_AddObjectRef` function doesn't steal a reference, so an extra `Py_DECREF` is needed. Automerge-Triggered-By: GH:tiran --- 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; }