summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2020-06-13 15:57:22 (GMT)
committerGitHub <noreply@github.com>2020-06-13 15:57:22 (GMT)
commit9672912e8f90374fd31b37ca0fb7cefbc6f4c555 (patch)
tree8c01ec48d6207a1ee57b7fc94652c9f0eeb1acb2 /Python/fileutils.c
parent29c117202e386bad1d66ae336e2fefa1a1809ee0 (diff)
downloadcpython-9672912e8f90374fd31b37ca0fb7cefbc6f4c555.zip
cpython-9672912e8f90374fd31b37ca0fb7cefbc6f4c555.tar.gz
cpython-9672912e8f90374fd31b37ca0fb7cefbc6f4c555.tar.bz2
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 439bc35..22e72bd 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;
}