[Python-3000-checkins] r58457 - python/branches/py3k/Modules/posixmodule.c
neal.norwitz
python-3000-checkins at python.org
Sun Oct 14 05:24:43 CEST 2007
Author: neal.norwitz
Date: Sun Oct 14 05:23:09 2007
New Revision: 58457
Modified:
python/branches/py3k/Modules/posixmodule.c
Log:
Fix some more memory leaks (in error conditions) introduced in r58455.
Also fix some indentation.
Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c (original)
+++ python/branches/py3k/Modules/posixmodule.c Sun Oct 14 05:23:09 2007
@@ -2139,7 +2139,8 @@
Py_FileSystemDefaultEncoding, &name, &len))
return NULL;
if (len >= MAX_PATH) {
- PyErr_SetString(PyExc_ValueError, "path too long");
+ PyMem_Free(name);
+ PyErr_SetString(PyExc_ValueError, "path too long");
return NULL;
}
strcpy(namebuf, name);
@@ -2150,7 +2151,7 @@
namebuf[len++] = SEP;
strcpy(namebuf + len, "*.*");
- if ((d = PyList_New(0)) == NULL) {
+ if ((d = PyList_New(0)) == NULL) {
PyMem_Free(name);
return NULL;
}
@@ -2164,7 +2165,7 @@
if (rc != NO_ERROR) {
errno = ENOENT;
- return posix_error_with_filename(name);
+ return posix_error_with_allocated_filename(name);
}
if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */
More information about the Python-3000-checkins
mailing list