]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use std::unique_ptr for rgw_aws4_auth management. 8053/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 11 Mar 2016 16:34:33 +0000 (17:34 +0100)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 11 Mar 2016 22:08:01 +0000 (23:08 +0100)
This is purely for code maintainability.

Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_rest_s3.cc

index 24b33c3f3d248cc23cf97536e487ee30885bef15..393a8480006735f73a653751b5fd710b26389bef 100644 (file)
@@ -213,8 +213,6 @@ req_state::req_state(CephContext* _cct, RGWEnv* e, RGWUserInfo* u)
   http_auth = NULL;
   local_source = false;
 
-  aws4_auth = NULL;
-
   obj_ctx = NULL;
 }
 
@@ -222,7 +220,6 @@ req_state::~req_state() {
   delete formatter;
   delete bucket_acl;
   delete object_acl;
-  delete aws4_auth;
 }
 
 struct str_len {
index 949fc52a2b70bef7f85eac4f85cf8c7966cdb847..b904c9856a9336f4427ecc9c6364750a3e939a68 100644 (file)
@@ -1226,7 +1226,7 @@ struct req_state {
 
   /* aws4 auth support */
   bool aws4_auth_needs_complete;
-  rgw_aws4_auth *aws4_auth;
+  unique_ptr<rgw_aws4_auth> aws4_auth;
 
   string canned_acl;
   bool has_acl_header;
index 825ac607959bc1da8cf9ce63e9da8c5f1f0bc974..c905a19129be07911251199d66ebcfd26d5e2bb1 100644 (file)
@@ -3161,7 +3161,7 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s)
   string algorithm = "AWS4-HMAC-SHA256";
 
   try {
-    s->aws4_auth = new rgw_aws4_auth;
+    s->aws4_auth = std::unique_ptr<rgw_aws4_auth>(new rgw_aws4_auth);
   } catch (std::bad_alloc&) {
     return -ENOMEM;
   }