]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/chain_xattr: do not double memory buffer (again)
authorSage Weil <sage@inktank.com>
Mon, 29 Oct 2012 15:34:58 +0000 (08:34 -0700)
committerSage Weil <sage@inktank.com>
Mon, 5 Nov 2012 08:13:54 +0000 (00:13 -0800)
This appears to be a typo; there is no need to double (again) the size of
the buffer we allocate.

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/chain_xattr.cc

index ea9bcdd202f6439f75682f9ec3086af97cd51803..b4d5d005dc880d02097a1d41f21251b2346965c8 100644 (file)
@@ -342,7 +342,7 @@ int chain_listxattr(const char *fn, char *names, size_t len) {
     return r;
 
   size_t total_len = r  * 2; // should be enough
-  char *full_buf = (char *)malloc(total_len * 2);
+  char *full_buf = (char *)malloc(total_len);
   if (!full_buf)
     return -ENOMEM;
 
@@ -387,8 +387,8 @@ int chain_flistxattr(int fd, char *names, size_t len) {
   if (r < 0)
     return r;
 
+  size_t total_len = r * 2; // should be enough
   size_t total_len = r  * 2; // should be enough
-  char *full_buf = (char *)malloc(total_len * 2);
   if (!full_buf)
     return -ENOMEM;