]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fixing a dangling pointer 38899/head
authorRonen Friedman <rfriedma@redhat.com>
Thu, 14 Jan 2021 08:02:19 +0000 (10:02 +0200)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 14 Jan 2021 08:02:19 +0000 (10:02 +0200)
... 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 <rfriedma@redhat.com>
src/os/bluestore/BlueStore.cc

index adc16660e386895b6f481da5124bf618589aca09..15bba8bcfbc26824515816d73ac53a19ca653be3 100644 (file)
@@ -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);