From: Petr Viktorin Date: Wed, 12 May 2021 16:04:34 +0000 (+0200) Subject: bpo-40645: Fix reference leak in the _hashopenssl extension (GH-26072) X-Git-Tag: v3.11.0a1~1144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3611db53f5b854cb6d01ee5ebb5e11c87bcc2df5;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index b2c67759e95e..13634a579f0d 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; }