From: stratakis Date: Thu, 14 Mar 2019 15:35:40 +0000 (+0100) Subject: [2.7] bpo-36289: Fix a possible reference leak in the io module (GH-12329) X-Git-Tag: v2.7.17rc1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dd6e079ae71f3723fbea2582ac080be06a6968f;p=thirdparty%2FPython%2Fcpython.git [2.7] bpo-36289: Fix a possible reference leak in the io module (GH-12329) Fix a reference leak in _bufferedreader_read_all(): _io.BufferedIOMixin.read() leaks a reference on 'data' when it reads the whole file content but flush() fails. --- diff --git a/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst b/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst new file mode 100644 index 000000000000..8917bee727bf --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-14-15-42-48.bpo-36289.wYKS47.rst @@ -0,0 +1 @@ +Fix a possible reference leak in the io module. diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index b8c98a4d0d04..d68f7d85b029 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1363,6 +1363,7 @@ _bufferedreader_read_all(buffered *self) res = buffered_flush_and_rewind_unlocked(self); if (res == NULL) { Py_DECREF(chunks); + Py_XDECREF(data); return NULL; } Py_CLEAR(res);