summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-13 16:18:52 (GMT)
committerGitHub <noreply@github.com>2020-06-13 16:18:52 (GMT)
commitc932f5c1e531f5a3cbf0ce664e4bcd22aa04994d (patch)
tree7b016f98af9d615b7855f9fbb9eb7e926d0ff426 /Python/fileutils.c
parent94bb4b7db2a4eadd299acede204b087aca30c9a2 (diff)
downloadcpython-c932f5c1e531f5a3cbf0ce664e4bcd22aa04994d.zip
cpython-c932f5c1e531f5a3cbf0ce664e4bcd22aa04994d.tar.gz
cpython-c932f5c1e531f5a3cbf0ce664e4bcd22aa04994d.tar.bz2
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 9672912e8f90374fd31b37ca0fb7cefbc6f4c555) Co-authored-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;
}