From: Kefu Chai Date: Sun, 14 Jun 2026 08:47:59 +0000 (+0800) Subject: test/objectstore: hold split_blob cache shards in unique_ptr X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cdb37469b09e178b78c0ca161d0073f0842c034b;p=ceph.git test/objectstore: hold split_blob cache shards in unique_ptr ExtentMap.split_blob, added in be93e121a98, creates the onode and buffer cache shards as raw pointers and never frees them. once we build with ASan, LeakSanitizer reports them (and the structures they own): Direct leak of 9928 byte(s) ... BlueStore::OnodeCacheShard::create Direct leak of 224 byte(s) ... BlueStore::BufferCacheShard::create SUMMARY: AddressSanitizer: 10288 byte(s) leaked in 8 allocation(s). every other test in this file already wraps these shards in a unique_ptr, declared before the collection that borrows them so they outlive it. do the same here. Signed-off-by: Kefu Chai --- diff --git a/src/test/objectstore/test_bluestore_types.cc b/src/test/objectstore/test_bluestore_types.cc index 23f7b847f83..c2025a25e1f 100644 --- a/src/test/objectstore/test_bluestore_types.cc +++ b/src/test/objectstore/test_bluestore_types.cc @@ -1078,12 +1078,12 @@ TEST(Blob, split) { TEST(ExtentMap, split_blob) { BlueStore store(g_ceph_context, "", 4096); - BlueStore::OnodeCacheShard *oc = - BlueStore::OnodeCacheShard::create(g_ceph_context, "lru", NULL); - BlueStore::BufferCacheShard *bc = - BlueStore::BufferCacheShard::create(&store, "lru", NULL); + std::unique_ptr oc{ + BlueStore::OnodeCacheShard::create(g_ceph_context, "lru", NULL)}; + std::unique_ptr bc{ + BlueStore::BufferCacheShard::create(&store, "lru", NULL)}; - auto coll = ceph::make_ref(&store, oc, bc, coll_t()); + auto coll = ceph::make_ref(&store, oc.get(), bc.get(), coll_t()); BlueStore::Onode onode(coll.get(), ghobject_t(), ""); size_t shard_size = g_ceph_context->_conf->bluestore_extent_map_inline_shard_prealloc_size;