]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: avoid string_view to temporary in RGWBulkUploadOp 47905/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 1 Sep 2022 14:50:46 +0000 (10:50 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 1 Sep 2022 14:51:26 +0000 (10:51 -0400)
the `else` block below constructs a temporary std::string that destructs
at the end of the statement, leaving `filename` as a dangling view:
```
filename = file_prefix + std::string(header->get_filename());
```
store a copy of the `std::string` instead

Fixes: https://tracker.ceph.com/issues/57326
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index 1c3ec52e3c13d54c287b89a54ce934d32e98922a..e3af288417a67520a2d7546c44ab79c3dd027d92 100644 (file)
@@ -7587,7 +7587,7 @@ void RGWBulkUploadOp::execute(optional_yield y)
         case rgw::tar::FileType::NORMAL_FILE: {
           ldpp_dout(this, 2) << "handling regular file" << dendl;
 
-          std::string_view filename;
+          std::string filename;
          if (bucket_path.empty())
            filename = header->get_filename();
          else