From: Yehuda Sadeh Date: Thu, 27 Sep 2012 22:13:46 +0000 (-0700) Subject: rgw: fix leaks in certain error paths X-Git-Tag: v0.54~83^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=091bf4550ed55591a63ab0a4544c1b5cc000ca53;p=ceph.git rgw: fix leaks in certain error paths Fixes a few coverity issues Conflicts: src/rgw/rgw_rados.cc Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index c5f47068aa5..07b45c71436 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -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); } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 9c136a8aad5..a0e7ffc3d78 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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;