Commit 2dd6e079 authored by stratakis's avatar stratakis Committed by Victor Stinner

[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.
parent fb3336ac
Fix a possible reference leak in the io module.
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment