From 00ddd87e28041e74ce02da2c00270844ff90bdd2 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 14 Jan 2021 10:02:19 +0200 Subject: [PATCH] os/bluestore: fixing a dangling pointer ... and silencing compiler warnings: Building CXX object src/os/CMakeFiles/os.dir/bluestore/BlueStore.cc.o ../src/os/bluestore/BlueStore.cc:8603:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl] const char *c = it->key().c_str(); ^~~~~~~~~ ../src/os/bluestore/BlueStore.cc:8623:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl] const char* c = it->key().c_str(); ^~~~~~~~~ (reverting a minor part of ifed01) Signed-off-by: Ronen Friedman --- src/os/bluestore/BlueStore.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index adc16660e386..15bba8bcfbc2 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8600,7 +8600,8 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair) for (it->lower_bound(string()); it->valid(); it->next()) { uint64_t pool; uint64_t omap_head; - const char *c = it->key().c_str(); + string k = it->key(); + const char *c = k.c_str(); c = _key_decode_u64(c, &pool); c = _key_decode_u64(c, &omap_head); if (used_omap_head.count(omap_head) == 0 && @@ -8620,7 +8621,8 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair) uint64_t pool; uint32_t hash; uint64_t omap_head; - const char* c = it->key().c_str(); + string k = it->key(); + const char* c = k.c_str(); c = _key_decode_u64(c, &pool); c = _key_decode_u32(c, &hash); c = _key_decode_u64(c, &omap_head); -- 2.47.3