[Python-checkins] bpo-40645: Fix reference leak in the _hashopenssl extension (GH-26072)

miss-islington webhook-mailer at python.org
Wed May 12 12:04:43 EDT 2021


https://github.com/python/cpython/commit/3611db53f5b854cb6d01ee5ebb5e11c87bcc2df5
commit: 3611db53f5b854cb6d01ee5ebb5e11c87bcc2df5
branch: main
author: Petr Viktorin <encukou at gmail.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-05-12T09:04:34-07:00
summary:

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

files:
M Modules/_hashopenssl.c

diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index b2c67759e95ea..13634a579f0dd 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;
 }
 



More information about the Python-checkins mailing list