From cda5c068a460c29dab3a24abcfcc55a200ce77b3 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sun, 12 Aug 2007 17:09:36 +0000 Subject: Fix memory leak in an error condition --- Modules/posixmodule.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- cgit v0.12