]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Delete onsafe 17877/head
authorJos Collin <jcollin@redhat.com>
Thu, 7 Sep 2017 07:11:40 +0000 (12:41 +0530)
committerNathan Cutler <ncutler@suse.com>
Thu, 21 Sep 2017 08:35:20 +0000 (10:35 +0200)
Variable "onsafe" going out of scope leaks the storage it points to. This fixes the Coverity
Scan CID 1417473.

Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit e24a91e9189587c800ef5709c78f1bc0e0ac8419)

src/client/Client.cc

index ea1c3c2cf5bfee4119778746c7af7c3e65801a7e..73f03aa07b7a74d8a7bffa5189103d869a4f4340 100644 (file)
@@ -12652,7 +12652,7 @@ int Client::ll_write_block(Inode *in, uint64_t blockid,
   Cond cond;
   bool done;
   int r = 0;
-  Context *onsafe;
+  Context *onsafe = nullptr;
 
   if (length == 0) {
     return -EINVAL;
@@ -12686,6 +12686,7 @@ int Client::ll_write_block(Inode *in, uint64_t blockid,
   client_lock.Lock();
   if (unmounting) {
     client_lock.Unlock();
+    delete onsafe;
     return -ENOTCONN;
   }