summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 a7fd8e8782..07a7eab04a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -91,8 +91,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 1149856e30..8e84392d5c 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10119,8 +10119,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(&path);
break;
}