diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 20:59:04 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 20:59:04 (GMT) |
commit | 932af110d36932d940eaa01d1a3759f0347a59fd (patch) | |
tree | 4bff6ba41fac5b54fc1ebf63b728f10a164ecce6 /Objects | |
parent | 7292e921fc9b0128a2224eb4cd45c2649211c9cf (diff) | |
download | cpython-932af110d36932d940eaa01d1a3759f0347a59fd.zip cpython-932af110d36932d940eaa01d1a3759f0347a59fd.tar.gz cpython-932af110d36932d940eaa01d1a3759f0347a59fd.tar.bz2 |
Patch #102868 from cgw: fix memory leak when an EOF is encountered
using GNU libc's getline()
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/fileobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 43b81ed..96d3830 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -660,6 +660,9 @@ get_line(PyFileObject *f, int n) n1 = getline(&buf, &size, fp); Py_END_ALLOW_THREADS if (n1 == -1) { + if (buf){ + free(buf); + } clearerr(fp); if (PyErr_CheckSignals()) { return NULL; |