From: Matt Benjamin Date: Mon, 14 Dec 2015 20:31:55 +0000 (-0500) Subject: librgw: fix some incorrect uses of string temporary X-Git-Tag: v10.1.0~382^2~108 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a27a4070b483bbe644f7099efd283d49533f5e23;p=ceph.git librgw: fix some incorrect uses of string temporary Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index bd65a6bdfda7..24755a93095d 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);