]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/kv_store_bench.cc: fix resource leak
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 13 May 2013 11:03:18 +0000 (13:03 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 14 May 2013 16:39:30 +0000 (18:39 +0200)
CID 727984 (#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "cb_args" going out of scope leaks the storage
  it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/kv_store_bench.cc

index ba5b795d95b578759285c3bf6f2d715e75246625..698105c9f39b4a99911b411993dc1ac5f5d4eddc 100644 (file)
@@ -373,6 +373,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
       kv = (((KvStoreBench *)this)->*distr)(true);
       if (kv.first == "") {
        i--;
+       delete cb_args;
        continue;
       }
       ops_in_flight++;
@@ -384,6 +385,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
       kv = (((KvStoreBench *)this)->*distr)(false);
       if (kv.first == "") {
        i--;
+       delete cb_args;
        continue;
       }
       ops_in_flight++;
@@ -395,6 +397,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
       kv = (((KvStoreBench *)this)->*distr)(false);
       if (kv.first == "") {
        i--;
+       delete cb_args;
        continue;
       }
       key_set.erase(kv.first);
@@ -406,6 +409,7 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
       kv = (((KvStoreBench *)this)->*distr)(false);
       if (kv.first == "") {
        i--;
+       delete cb_args;
        continue;
       }
       bufferlist val;
@@ -415,6 +419,10 @@ int KvStoreBench::test_teuthology_aio(next_gen_t distr,
          cb_args, &cb_args->err);
       break;
     }
+
+    if (cb_args) {
+      delete cb_args;
+    }
   }
 
   while(ops_in_flight > 0) {