Author: alexandre.vassalotti
Date: Sun Oct 14 04:54:41 2007
New Revision: 58456

Modified:
   python/branches/py3k/Modules/posixmodule.c
Log:
Fix the memory leak introduced in r58455. The buffer reference
returned by 'et' need to be freed after use.


Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c  (original)
+++ python/branches/py3k/Modules/posixmodule.c  Sun Oct 14 04:54:41 2007
@@ -2150,8 +2150,10 @@
         namebuf[len++] = SEP;
     strcpy(namebuf + len, "*.*");
 
-       if ((d = PyList_New(0)) == NULL)
+       if ((d = PyList_New(0)) == NULL) {
+        PyMem_Free(name);
         return NULL;
+    }
 
     rc = DosFindFirst(namebuf,         /* Wildcard Pattern to Match */
                       &hdir,           /* Handle to Use While Search Directory 
*/
@@ -2192,6 +2194,7 @@
         } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && 
srchcnt > 0);
     }
 
+    PyMem_Free(name);
     return d;
 #else
 
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to