From cab8e9bfcdd7ce0580904bb001c58f1dad5f43bb Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 13 May 2013 13:03:18 +0200 Subject: [PATCH] test/kv_store_bench.cc: fix resource leak 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 --- src/test/kv_store_bench.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/kv_store_bench.cc b/src/test/kv_store_bench.cc index ba5b795d95b57..698105c9f39b4 100644 --- a/src/test/kv_store_bench.cc +++ b/src/test/kv_store_bench.cc @@ -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) { -- 2.39.5