]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rgw_gc.cc: fix possible NULL pointer dereference
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 16 May 2013 12:10:42 +0000 (14:10 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 16 May 2013 12:10:42 +0000 (14:10 +0200)
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 <danny.al-gaaf@bisect.de>
src/rgw/rgw_gc.cc

index 11d7f0e38def1849f211605bf09c60716edbbc61..353afd5847a813424ec3b293234bdafcb038ed86 100644 (file)
@@ -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;