]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix leaks in certain error paths
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 27 Sep 2012 22:13:46 +0000 (15:13 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 8 Oct 2012 22:12:40 +0000 (15:12 -0700)
Fixes a few coverity issues

Conflicts:
src/rgw/rgw_rados.cc

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_main.cc
src/rgw/rgw_rados.cc

index c5f47068aa5fc9bac157bc5f3c2189cc4773475d..07b45c71436f6ac58ad7e0b2d9415bca5ed5a03d 100644 (file)
@@ -234,8 +234,10 @@ void RGWProcess::run()
     FCGX_InitRequest(&req->fcgx, s, 0);
     req_throttle.get(1);
     int ret = FCGX_Accept_r(&req->fcgx);
-    if (ret < 0)
+    if (ret < 0) {
+      delete req;
       break;
+    }
 
     req_wq.queue(req);
   }
index 9c136a8aad5ff0c6e53a6f84949533f7439bb638..a0e7ffc3d787f6088277472cca865b6ce894c1dc 100644 (file)
@@ -393,8 +393,10 @@ int RGWRados::log_list_init(const string& prefix, RGWAccessHandle *handle)
   log_list_state *state = new log_list_state;
   const char *log_pool = params.log_pool.name.c_str();
   int r = rados->ioctx_create(log_pool, state->io_ctx);
-  if (r < 0)
+  if (r < 0) {
+    delete state;
     return r;
+  }
   state->prefix = prefix;
   state->obit = state->io_ctx.objects_begin();
   *handle = (RGWAccessHandle)state;
@@ -446,8 +448,10 @@ int RGWRados::log_show_init(const string& name, RGWAccessHandle *handle)
   log_show_state *state = new log_show_state;
   const char *log_pool = params.log_pool.name.c_str();
   int r = rados->ioctx_create(log_pool, state->io_ctx);
-  if (r < 0)
+  if (r < 0) {
+    delete state;
     return r;
+  }
   state->name = name;
   *handle = (RGWAccessHandle)state;
   return 0;