From: Antoine Pitrou Date: Mon, 13 May 2013 17:46:29 +0000 (+0200) Subject: Issue #17968: Fix memory leak in os.listxattr(). X-Git-Tag: v3.4.0a1~734^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f987398b7fa8984ab8aa88acff2b7e1d89e3da7;p=thirdparty%2FPython%2Fcpython.git Issue #17968: Fix memory leak in os.listxattr(). --- diff --git a/Misc/NEWS b/Misc/NEWS index c81aeb489c73..28cdf7e05c68 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 551af2f5a8c6..3e5e58045fdc 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; }