]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40645: Fix reference leak in the _hashopenssl extension (GH-26072)
authorPetr Viktorin <encukou@gmail.com>
Wed, 12 May 2021 16:04:34 +0000 (18:04 +0200)
committerGitHub <noreply@github.com>
Wed, 12 May 2021 16:04:34 +0000 (09:04 -0700)
The `PyModule_AddObjectRef` function doesn't steal a reference, so an extra `Py_DECREF` is needed.

Automerge-Triggered-By: GH:tiran
Modules/_hashopenssl.c

index b2c67759e95ea30804f58b634a563b46987735b6..13634a579f0ddb8a3e20cc31c2d4f5903c42b95d 100644 (file)
@@ -2109,6 +2109,7 @@ hashlib_init_constructors(PyObject *module)
     if (PyModule_AddObjectRef(module, "_constructors", proxy) < 0) {
         return -1;
     }
+    Py_DECREF(proxy);
     return 0;
 }