]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use std::unique_ptr for rgw_aws4_auth management.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 11 Mar 2016 16:34:33 +0000 (17:34 +0100)
committerJavier M. Mellid <jmunhoz@igalia.com>
Fri, 29 Jul 2016 11:15:47 +0000 (13:15 +0200)
This is purely for code maintainability.

Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit 6f273eb52c07b27c7aa2d69be3e5ff5d6578558c)

src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_rest_s3.cc

index d597339a7e70f702720241354889b072551b59ca..a76e2f200670287767a1197d869cedcfacfc7836 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 39e0d4acd3f5016f0872fc1118d0b819e3885482..c94d19f29c615f7648d812d2cc8d60bd2d384ee0 100644 (file)
@@ -1260,7 +1260,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 250b8879f76ed0c3a2669ed3770ec39ae64898a3..ec09449f613dc3ca4854fb07d8836d188e772ad9 100644 (file)
@@ -3228,7 +3228,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;
   }