]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17968: Fix memory leak in os.listxattr().
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 13 May 2013 17:46:29 +0000 (19:46 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 13 May 2013 17:46:29 +0000 (19:46 +0200)
Misc/NEWS
Modules/posixmodule.c

index c81aeb489c734c80a1d9b69973de0d1aff13b4fe..28cdf7e05c682a5beae17b35f87efb85c54e4fad 100644 (file)
--- 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
index 551af2f5a8c6c3715ce0a55e0c5ceefb089d0c63..3e5e58045fdcd0fd5f22c27742d4cfc945389281 100644 (file)
@@ -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;
         }