Title: _bufferedreader_read_all() may leak reference to data
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, pitrou, python-dev, sbt, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-07-01 23:11 by christian.heimes, last changed 2013-07-15 17:51 by sbt. This issue is now closed.

File name Uploaded Description Edit
buf-readall.patch sbt, 2013-07-02 07:29 review
Messages (3)
msg192160 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-01 23:11
Modules/_io/bufferedio.c:_bufferedreader_read_all() doesn't call Py_XDECREF(data) multiple times and may leak a reference in an error case. For example the ref leak occurs when current_size > 0 and PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readall, NULL) fails orbuffered_flush_and_rewind_unlocked(self) fails.

There are a few more places where data isn't decrefed on return, too.

CID 715364 (#2 of 2): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable "data" going out of scope leaks the storage it points to.
msg192178 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2013-07-02 07:29
Patch attached.
msg193110 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-07-15 15:11
New changeset 9ce863993a38 by Richard Oudkerk in branch '3.3':
Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all().

New changeset 9b041f44cb63 by Richard Oudkerk in branch 'default':
Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all().
Date User Action Args
2013-07-15 17:51:09sbtsetresolution: fixed
stage: needs patch -> resolved
2013-07-15 17:16:01sbtsetstatus: open -> closed
2013-07-15 15:11:29python-devsetnosy: + python-dev
messages: + msg193110
2013-07-02 07:29:01sbtsetfiles: + buf-readall.patch
keywords: + patch
messages: + msg192178
2013-07-02 07:19:38serhiy.storchakasetnosy: + serhiy.storchaka
2013-07-01 23:12:36vstinnersetnosy: + pitrou, sbt
2013-07-01 23:11:04christian.heimescreate