From cd48f57039b3ea0831f8c90bcf094b586fba7520 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Thu, 16 May 2013 14:10:42 +0200 Subject: [PATCH] rgw/rgw_gc.cc: fix possible NULL pointer dereference Fix/silence cppcheck warning: [src/rgw/rgw_gc.cc:185] -> [src/rgw/rgw_gc.cc:181]: (error) Possible null pointer dereference: ctx - otherwise it is redundant to check it against null. Signed-off-by: Danny Al-Gaaf --- src/rgw/rgw_gc.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_gc.cc b/src/rgw/rgw_gc.cc index 11d7f0e38def1..353afd5847a81 100644 --- a/src/rgw/rgw_gc.cc +++ b/src/rgw/rgw_gc.cc @@ -178,10 +178,8 @@ int RGWGC::process(int index, int max_secs) cls_rgw_obj& obj = *liter; if (obj.pool != last_pool) { - if (ctx) { - delete ctx; - ctx = new IoCtx; - } + delete ctx; + ctx = new IoCtx; ret = store->rados->ioctx_create(obj.pool.c_str(), *ctx); if (ret < 0) { dout(0) << "ERROR: failed to create ioctx pool=" << obj.pool << dendl; -- 2.39.5