From 6f273eb52c07b27c7aa2d69be3e5ff5d6578558c Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Fri, 11 Mar 2016 17:34:33 +0100 Subject: [PATCH] rgw: use std::unique_ptr for rgw_aws4_auth management. This is purely for code maintainability. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_common.cc | 3 --- src/rgw/rgw_common.h | 2 +- src/rgw/rgw_rest_s3.cc | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 24b33c3f3d24..393a84800067 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -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 { diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 949fc52a2b70..b904c9856a93 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1226,7 +1226,7 @@ struct req_state { /* aws4 auth support */ bool aws4_auth_needs_complete; - rgw_aws4_auth *aws4_auth; + unique_ptr aws4_auth; string canned_acl; bool has_acl_header; diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 825ac607959b..c905a19129be 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -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(new rgw_aws4_auth); } catch (std::bad_alloc&) { return -ENOMEM; } -- 2.47.3