From: Ronen Friedman Date: Thu, 14 Jan 2021 08:02:19 +0000 (+0200) Subject: os/bluestore: fixing a dangling pointer X-Git-Tag: v16.1.0~21^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=00ddd87e28041e74ce02da2c00270844ff90bdd2;p=ceph.git 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 --- 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);