From 091bf4550ed55591a63ab0a4544c1b5cc000ca53 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 27 Sep 2012 15:13:46 -0700 Subject: [PATCH] rgw: fix leaks in certain error paths Fixes a few coverity issues Conflicts: src/rgw/rgw_rados.cc Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_main.cc | 4 +++- src/rgw/rgw_rados.cc | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index c5f47068aa5fc..07b45c71436f6 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 9c136a8aad5ff..a0e7ffc3d787f 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; -- 2.39.5