From 2a7feee76d054ca8dfbcb1b6e0569b5856cf18a3 Mon Sep 17 00:00:00 2001
From: Stefan Krah <stefan@bytereef.org>
Date: Sat, 27 Nov 2010 22:06:49 +0000
Subject: [PATCH] Windows: fix leak in posix_listdir.

---
 Modules/posixmodule.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index be99be8651..3197a0d2d8 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2396,6 +2396,7 @@ posix_listdir(PyObject *self, PyObject *args)
     }
     strcpy(namebuf, PyBytes_AsString(opath));
     len = PyObject_Size(opath);
+    Py_DECREF(opath);
     if (len > 0) {
         char ch = namebuf[len-1];
         if (ch != SEP && ch != ALTSEP && ch != ':')
-- 
2.40.0