From: Yehuda Sadeh Date: Fri, 21 Feb 2014 18:43:37 +0000 (-0800) Subject: rgw: get rid of a memory allocation X-Git-Tag: v0.79~105^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1515%2Fhead;p=ceph.git rgw: get rid of a memory allocation Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 2d7cb64f8b4a..9614b0787cc1 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -93,13 +93,8 @@ struct RGWRequest RGWRequest() : id(0), s(NULL), op(NULL) { } - ~RGWRequest() { - delete s; - } - - req_state *init_state(CephContext *cct, RGWEnv *env) { - s = new req_state(cct, env); - return s; + void init_state(req_state *_s) { + s = _s; } void log_format(struct req_state *s, const char *fmt, ...) @@ -516,7 +511,9 @@ static int process_request(RGWRados *store, RGWREST *rest, RGWRequest *req, RGWC RGWEnv& rgw_env = client_io->get_env(); - struct req_state *s = req->init_state(g_ceph_context, &rgw_env); + struct req_state rstate(g_ceph_context, &rgw_env); + + struct req_state *s = &rstate; RGWRadosCtx rados_ctx(store, s); s->obj_ctx = &rados_ctx;