From: Neal Norwitz Date: Sun, 12 Aug 2007 17:09:36 +0000 (+0000) Subject: Fix memory leak in an error condition X-Git-Tag: v3.0a1~426 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cda5c068a460c29dab3a24abcfcc55a200ce77b3;p=thirdparty%2FPython%2Fcpython.git Fix memory leak in an error condition --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 000f6a2ca345..d81674b5210f 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;