summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-12 17:09:36 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-12 17:09:36 (GMT)
commitcda5c068a460c29dab3a24abcfcc55a200ce77b3 (patch)
tree5d8c9f199aca5d48d7af10bcd89d50fd71abc0aa
parentfca70054c5704535f38dd780821bb1482c01eb1e (diff)
downloadcpython-cda5c068a460c29dab3a24abcfcc55a200ce77b3.zip
cpython-cda5c068a460c29dab3a24abcfcc55a200ce77b3.tar.gz
cpython-cda5c068a460c29dab3a24abcfcc55a200ce77b3.tar.bz2
Fix memory leak in an error condition
-rw-r--r--Modules/posixmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 000f6a2..d81674b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4293,7 +4293,10 @@ posix_readlink(PyObject *self, PyObject *args)
Py_FileSystemDefaultEncoding, &path))
return NULL;
v = PySequence_GetItem(args, 0);
- if (v == NULL) return NULL;
+ if (v == NULL) {
+ PyMem_Free(path);
+ return NULL;
+ }
if (PyUnicode_Check(v)) {
arg_is_unicode = 1;