Mercurial > cpython-lru_cache-weakref
diff Modules/posixmodule.c @ 43562:9fbf733a0639
Fix some more memory leaks (in error conditions) introduced in r58455.
Also fix some indentation.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 14 Oct 2007 03:23:09 +0000 |
| parents | 0015572d11bc |
| children | 19319e70fc3e |
line wrap: on
line diff
--- a/Modules/posixmodule.c Sun Oct 14 02:54:41 2007 +0000 +++ b/Modules/posixmodule.c Sun Oct 14 03:23:09 2007 +0000 @@ -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, */
