Free allocated memory before return

Signed-off-by: Li Wang <[email protected]>
---
 src/os/chain_xattr.cc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/os/chain_xattr.cc b/src/os/chain_xattr.cc
index 62733e3..0859564 100644
--- a/src/os/chain_xattr.cc
+++ b/src/os/chain_xattr.cc
@@ -354,8 +354,10 @@ int chain_listxattr(const char *fn, char *names, size_t 
len) {
     return -ENOMEM;
 
   r = sys_listxattr(fn, full_buf, total_len);
-  if (r < 0)
+  if (r < 0) {
+    goto done;
     return r;
+  }
 
   char *p = full_buf;
   const char *end = full_buf + r;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to