diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2007-10-14 02:54:41 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2007-10-14 02:54:41 (GMT) |
commit | 4167ebcfee0449a89c359b8d68530bae92620f45 (patch) | |
tree | de69a37cda70ac1754a274b783bf335ca5fc9eed /Modules/posixmodule.c | |
parent | 70a237179f1213b0c180898b6e1f0b6c4e9cd11c (diff) | |
download | cpython-4167ebcfee0449a89c359b8d68530bae92620f45.zip cpython-4167ebcfee0449a89c359b8d68530bae92620f45.tar.gz cpython-4167ebcfee0449a89c359b8d68530bae92620f45.tar.bz2 |
Fix the memory leak introduced in r58455. The buffer reference
returned by 'et' need to be freed after usage.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 2fe2b63..53856b4 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2150,8 +2150,10 @@ posix_listdir(PyObject *self, PyObject *args) 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 @@ posix_listdir(PyObject *self, PyObject *args) } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && srchcnt > 0); } + PyMem_Free(name); return d; #else |