Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f47d79f

Browse files
committed
Fixed reference leak in error branch of _bufferedreader_read_all(). The variable data can contain a bytes object but it wasn't cleaned up when PyList_New() failed. CID 715364
1 parent 76c0829 commit f47d79f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_io/bufferedio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,8 +1499,10 @@ _bufferedreader_read_all(buffered *self)
14991499
}
15001500

15011501
chunks = PyList_New(0);
1502-
if (chunks == NULL)
1502+
if (chunks == NULL) {
1503+
Py_XDECREF(data);
15031504
return NULL;
1505+
}
15041506

15051507
while (1) {
15061508
if (data) {

0 commit comments

Comments
 (0)