]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
test/bluestore: fix memory leaks in ExtentMap.reshard_failure test 66898/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 12 Jan 2026 23:47:11 +0000 (07:47 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 13 Jan 2026 06:15:02 +0000 (14:15 +0800)
commita45f32e9b6206957c723e037da2c47775f10b918
treed02a3813c46a6fb2f417b16ca5bf5daa6c7acc5f
parent3818189f554106ab05896280ba2d510e2cbf2f01
test/bluestore: fix memory leaks in ExtentMap.reshard_failure test

The ExtentMap.reshard_failure test was leaking memory by not properly
cleaning up the OnodeCacheShard and BufferCacheShard objects it created.

ASan reported:
  Direct leak of 9928 byte(s) in 1 object(s) allocated from:
    #1 BlueStore::OnodeCacheShard::create() BlueStore.cc:1221
    #2 ExtentMap_reshard_failure_Test::TestBody() test_bluestore_types.cc:1244

  Direct leak of 224 byte(s) in 1 object(s) allocated from:
    #1 BlueStore::BufferCacheShard::create() BlueStore.cc:1680
    #2 ExtentMap_reshard_failure_Test::TestBody() test_bluestore_types.cc:1246

  SUMMARY: AddressSanitizer: 10288 byte(s) leaked in 8 allocation(s).

Fix by:
1. Wrapping coll and onode in an additional scope block to ensure they
   are destroyed before the cache shards (releasing all blob references)
2. Adding proper cleanup with delete bc and delete oc at test end

This matches the cleanup pattern used in BlueStoreFixture::TearDown().

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/test/objectstore/test_bluestore_types.cc