From: Casey Bodley Date: Thu, 1 Sep 2022 14:50:46 +0000 (-0400) Subject: rgw: avoid string_view to temporary in RGWBulkUploadOp X-Git-Tag: v17.2.7~228^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d406068df74e252b638c5e3c879d73bab3cd6c20;p=ceph.git rgw: avoid string_view to temporary in RGWBulkUploadOp 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 (cherry picked from commit e9c2ac02f1f59714677e3e1b984367df3c0ec166) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 14dc51ec3600..bb0f963631bb 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -7648,7 +7648,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