Fix memory leak

This commit is contained in:
Neal Norwitz 2007-08-12 16:56:02 +00:00
parent 72937f3216
commit fca70054c5
1 changed files with 2 additions and 1 deletions

View File

@ -4304,8 +4304,9 @@ posix_readlink(PyObject *self, PyObject *args)
n = readlink(path, buf, (int) sizeof buf);
Py_END_ALLOW_THREADS
if (n < 0)
return posix_error_with_filename(path);
return posix_error_with_allocated_filename(path);
PyMem_Free(path);
v = PyString_FromStringAndSize(buf, n);
if (arg_is_unicode) {
PyObject *w;