From d8a8894cb24baab2a98ee3bd3a15dae12c76b9e7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 11 Oct 2013 11:51:13 +0100 Subject: [PATCH] daemon: xattr: Fix scope of cleanup buf to avoid memory leaks. Found by ./configure --enable-valgrind-daemon. --- daemon/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/xattr.c b/daemon/xattr.c index 16a01a670..7baf35656 100644 --- a/daemon/xattr.c +++ b/daemon/xattr.c @@ -267,7 +267,6 @@ do_internal_lxattrlist (const char *path, char *const *names) size_t i, j; size_t k, m, nr_attrs; ssize_t len, vlen; - CLEANUP_FREE char *buf = NULL; ret = malloc (sizeof (*ret)); if (ret == NULL) { @@ -281,6 +280,7 @@ do_internal_lxattrlist (const char *path, char *const *names) for (k = 0; names[k] != NULL; ++k) { void *newptr; CLEANUP_FREE char *pathname = NULL; + CLEANUP_FREE char *buf = NULL; /* Be careful in this loop about which errors cause the whole call * to abort, and which errors allow us to continue processing