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 <rep...@bugs.python.org>
<http://bugs.python.org/issue18368>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to