From a27a4070b483bbe644f7099efd283d49533f5e23 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Mon, 14 Dec 2015 15:31:55 -0500 Subject: [PATCH] librgw: fix some incorrect uses of string temporary Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index bd65a6bdfda7b..24755a93095d5 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -314,8 +314,9 @@ int rgw_unlink(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh, if (! rc) { /* rgw_fh ref+ */ RGWFileHandle* rgw_fh = get_rgwfh(fh); + std::string oname = rgw_fh->full_object_name(); RGWDeleteObjRequest req(cct, fs->get_user(), parent->bucket_name(), - rgw_fh->full_object_name()); + oname); rc = librgw.get_fe()->execute_req(&req); /* release */ (void) rgw_fh_rele(rgw_fs, fh, 0 /* flags */); @@ -456,11 +457,10 @@ int rgw_getattr(struct rgw_fs *rgw_fs, if (rgw_fh->creating()) goto done; - const std::string bname = rgw_fh->bucket_name(); - const std::string oname = rgw_fh->object_name(); + const std::string& bname = rgw_fh->bucket_name(); + const std::string& oname = rgw_fh->object_name(); - RGWStatObjRequest req(cct, fs->get_user(), - rgw_fh->bucket_name(), rgw_fh->object_name(), + RGWStatObjRequest req(cct, fs->get_user(), bname, oname, RGWStatObjRequest::FLAG_NONE); int rc = librgw.get_fe()->execute_req(&req); @@ -641,8 +641,9 @@ int rgw_write(struct rgw_fs *rgw_fs, buffer::create_static(length /* XXX size */, static_cast(buffer))); /* XXX */ + std::string oname = rgw_fh->full_object_name(); RGWPutObjRequest req(cct, fs->get_user(), rgw_fh->bucket_name(), - rgw_fh->full_object_name(), bl); + oname, bl); int rc = librgw.get_fe()->execute_req(&req); @@ -752,8 +753,9 @@ int rgw_readv(struct rgw_fs *rgw_fs, static_cast(vio->vio_base))); } + std::string oname = rgw_fh->full_object_name(); RGWPutObjRequest req(cct, fs->get_user(), rgw_fh->bucket_name(), - rgw_fh->full_object_name(), bl); + oname, bl); int rc = librgw.get_fe()->execute_req(&req); -- 2.39.5