]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Delete onsafe 17542/head
authorJos Collin <jcollin@redhat.com>
Thu, 7 Sep 2017 07:11:40 +0000 (12:41 +0530)
committerJos Collin <jcollin@redhat.com>
Thu, 7 Sep 2017 07:11:44 +0000 (12:41 +0530)
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>
src/client/Client.cc

index 1c256cecd9064c64d483a12ecebfcb9825da84b6..a95e6f00c999393f22e444a10963c2b6d4deaa53 100644 (file)
@@ -12651,7 +12651,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;
@@ -12685,6 +12685,7 @@ int Client::ll_write_block(Inode *in, uint64_t blockid,
   client_lock.Lock();
   if (unmounting) {
     client_lock.Unlock();
+    delete onsafe;
     return -ENOTCONN;
   }