]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix potential memory leak 9537/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 7 Jun 2016 06:39:11 +0000 (14:39 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 7 Jun 2016 06:39:11 +0000 (14:39 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/client/Client.cc

index 31cc936bce8dc43d0e2cf3d5756b00db7af4cf61..be85e87d840ff53abdd3b512096181eecc2b5608 100644 (file)
@@ -8366,8 +8366,10 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf,
   uint64_t totalwritten;
   int have;
   int r = get_caps(in, CEPH_CAP_FILE_WR, CEPH_CAP_FILE_BUFFER, &have, endoff);
-  if (r < 0)
+  if (r < 0) {
+    delete[] bparr;
     return r;
+  }
 
   if (f->flags & O_DIRECT)
     have &= ~CEPH_CAP_FILE_BUFFER;