]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
authorChristian Heimes <christian@python.org>
Sat, 13 Jun 2020 15:57:22 +0000 (17:57 +0200)
committerGitHub <noreply@github.com>
Sat, 13 Jun 2020 15:57:22 +0000 (00:57 +0900)
Signed-off-by: Christian Heimes <christian@python.org>
Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst [new file with mode: 0644]
Python/fileutils.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst
new file mode 100644 (file)
index 0000000..f99c374
--- /dev/null
@@ -0,0 +1 @@
+Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
index 439bc351596f7aa5dffaf6744cfab54ed3e4d79d..22e72bdd5a9c788e5c783764d478231395769ed8 100644 (file)
@@ -1461,6 +1461,7 @@ _Py_fopen_obj(PyObject *path, const char *mode)
     path_bytes = PyBytes_AS_STRING(bytes);
 
     if (PySys_Audit("open", "Osi", path, mode, 0) < 0) {
+        Py_DECREF(bytes);
         return NULL;
     }