From: Radoslaw Zarzynski Date: Fri, 11 Mar 2016 16:33:47 +0000 (+0100) Subject: rgw: add handling of memory allocation failure in AWS4 auth. X-Git-Tag: v10.2.3~42^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c422e306989f65d9112f95a131ff29479b2d0f0;p=ceph.git rgw: add handling of memory allocation failure in AWS4 auth. Signed-off-by: Radoslaw Zarzynski (cherry picked from commit ddbb0ab9d5046672795ec876221de9ebd466364f) --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 27ae9e696ab5..250b8879f76e 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -3227,7 +3227,11 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s) string algorithm = "AWS4-HMAC-SHA256"; - s->aws4_auth = new rgw_aws4_auth; + try { + s->aws4_auth = new rgw_aws4_auth; + } catch (std::bad_alloc&) { + return -ENOMEM; + } if ((!s->http_auth) || !(*s->http_auth)) {