]> granicus.if.org Git - python/commitdiff
Fix memory leak in an error condition
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 12 Aug 2007 17:09:36 +0000 (17:09 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 12 Aug 2007 17:09:36 +0000 (17:09 +0000)
Modules/posixmodule.c

index 000f6a2ca3453b4e2faf7b65a98fe9bf27c5a99c..d81674b5210fe2ef431690c4bbfb08db0140ea9c 100644 (file)
@@ -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;