[issue18368] PyOS_StdioReadline() leaks memory when realloc() fails

Christian Heimes report at bugs.python.org
Fri Jul 5 22:02:43 CEST 2013


New submission from Christian Heimes:

PyOS_StdioReadline() contains code such as:

   p = (char *)PyMem_REALLOC(p, n + incr);

The code looses its pointer to p when realloc fails and has no chance to free the memory in p.

Also the code sets PyExc_OverflowError when incr > INT_MAX but it doesn't return NULL to signal the error.

----------
components: Interpreter Core
files: osreadline.patch
keywords: patch
messages: 192352
nosy: christian.heimes
priority: normal
severity: normal
stage: patch review
status: open
title: PyOS_StdioReadline() leaks memory when realloc() fails
type: resource usage
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30782/osreadline.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18368>
_______________________________________


More information about the Python-bugs-list mailing list