[Python-checkins] bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Christian Heimes
webhook-mailer at python.org
Sat Jun 13 11:57:30 EDT 2020
https://github.com/python/cpython/commit/9672912e8f90374fd31b37ca0fb7cefbc6f4c555
commit: 9672912e8f90374fd31b37ca0fb7cefbc6f4c555
branch: master
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2020年06月14日T00:57:22+09:00
summary:
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Signed-off-by: Christian Heimes <christian at python.org>
files:
A Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst
M 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
index 0000000000000..f99c374f94aac
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst
@@ -0,0 +1 @@
+Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 439bc351596f7..22e72bdd5a9c7 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -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;
}
More information about the Python-checkins
mailing list