Commit 932af110 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

Patch #102868 from cgw: fix memory leak when an EOF is encountered

    using GNU libc's getline()
parent 7292e921
...@@ -660,6 +660,9 @@ get_line(PyFileObject *f, int n) ...@@ -660,6 +660,9 @@ get_line(PyFileObject *f, int n)
n1 = getline(&buf, &size, fp); n1 = getline(&buf, &size, fp);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (n1 == -1) { if (n1 == -1) {
if (buf){
free(buf);
}
clearerr(fp); clearerr(fp);
if (PyErr_CheckSignals()) { if (PyErr_CheckSignals()) {
return NULL; return NULL;
......
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