From 338ca7e96cecee20d651b4def457c173047350d6 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Thu, 30 Apr 2015 13:31:06 +0200 Subject: [PATCH] Fix memory leaks in get() failure handling path The freeing memory labels were used wrongly; easily reproducible by simulating failures in a loop. --- xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xattr.c b/xattr.c index cc1fa44..efa1e4d 100644 --- a/xattr.c +++ b/xattr.c @@ -367,13 +367,13 @@ xattr_get(PyObject *self, PyObject *args, PyObject *keywds) if(merge_ns(ns, attrname, &fullname, &namebuf) < 0) { res = NULL; - goto freearg; + goto freetgt; } /* Find out the needed size of the buffer */ if((nalloc = _get_obj(&tgt, fullname, NULL, 0)) == -1) { res = PyErr_SetFromErrno(PyExc_IOError); - goto freetgt; + goto freenamebuf; } /* Try to allocate the memory, using Python's allocator */ -- 2.39.5