summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-05-13 17:46:29 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-05-13 17:46:29 (GMT)
commit7f987398b7fa8984ab8aa88acff2b7e1d89e3da7 (patch)
tree02da96b647ba4eecb8bf15816e26f9d9353a3b31
parent901a278861d070e55b426f8fb67bb83707da96d2 (diff)
downloadcpython-7f987398b7fa8984ab8aa88acff2b7e1d89e3da7.zip
cpython-7f987398b7fa8984ab8aa88acff2b7e1d89e3da7.tar.gz
cpython-7f987398b7fa8984ab8aa88acff2b7e1d89e3da7.tar.bz2
Issue #17968: Fix memory leak in os.listxattr().
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/posixmodule.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index c81aeb4..28cdf7e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,8 +49,10 @@ Core and Builtins
Library
-------
+- Issue #17968: Fix memory leak in os.listxattr().
+
- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
- .characters() and ignorableWhitespace() methods. Original patch by Sebastian
+ characters() and ignorableWhitespace() methods. Original patch by Sebastian
Ortiz Vasquez.
- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 551af2f..3e5e580 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10625,8 +10625,10 @@ posix_listxattr(PyObject *self, PyObject *args, PyObject *kwargs)
Py_END_ALLOW_THREADS;
if (length < 0) {
- if (errno == ERANGE)
+ if (errno == ERANGE) {
+ PyMem_FREE(buffer);
continue;
+ }
path_error("listxattr", &path);
break;
}