]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: get rid of a memory allocation 1515/head
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 21 Feb 2014 18:43:37 +0000 (10:43 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 21 Mar 2014 22:16:23 +0000 (15:16 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_main.cc

index 2d7cb64f8b4a52ef8b1021848d519082b1e12750..9614b0787cc193dc36ef135ed641c0bb01943fcf 100644 (file)
@@ -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;