]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add coverity annotations for resource leak false positives 51972/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Wed, 7 Jun 2023 17:32:40 +0000 (23:02 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Wed, 7 Jun 2023 17:32:40 +0000 (23:02 +0530)
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/driver/rados/cls_fifo_legacy.h
src/rgw/driver/rados/rgw_gc.cc
src/rgw/rgw_aio_throttle.cc
src/rgw/rgw_d3n_cacherequest.h
src/rgw/rgw_kafka.cc
src/rgw/rgw_kmip_client_impl.cc
src/rgw/rgw_period_history.cc

index b0a68157e619582bc0e7caa720708a4966400570..d0efe20a071816590136202c1670894403210ddb 100644 (file)
@@ -314,6 +314,7 @@ public:
                                               &cb);
     auto c = p->_cur;
     p.release();
+    // coverity[RESOURCE_LEAK:FALSE]
     return c;
   }
   static void complete(Ptr&& p, int r) {
index bd16bde1bd5dbeac47926845d1a8f16dbeac1504..850b9ed72e329c5c737e2f836210d02ab6511782 100644 (file)
@@ -214,6 +214,7 @@ int RGWGC::async_defer_chain(const string& tag, const cls_rgw_obj_chain& chain)
 
   int ret = store->gc_aio_operate(obj_names[i], state->completion, &op);
   if (ret == 0) {
+    // coverity[RESOURCE_LEAK:FALSE]
     state.release(); // release ownership until async_defer_callback()
   }
   return ret;
index 91f8202a08e2e0a3d1942f2fd49389c85d187896..59f006c07e65c7e0ae242fa119e44619f06135c2 100644 (file)
@@ -57,6 +57,7 @@ AioResultList BlockingAioThrottle::get(rgw_raw_obj obj,
     std::move(f)(this, *static_cast<AioResult*>(p.get()));
     lock.lock();
   }
+  // coverity[RESOURCE_LEAK:FALSE]
   p.release();
   return std::move(completed);
 }
@@ -146,6 +147,7 @@ AioResultList YieldingAioThrottle::get(rgw_raw_obj obj,
     pending.push_back(*p);
     std::move(f)(this, *static_cast<AioResult*>(p.get()));
   }
+  // coverity[RESOURCE_LEAK:FALSE]
   p.release();
   return std::move(completed);
 }
index d58359c5e848c116086996c82aa63be93191ead9..48fdbe168bb0af872b99e316dce62937b8b6c424 100644 (file)
@@ -114,6 +114,7 @@ struct D3nL1CacheRequest {
       auto ec = boost::system::error_code{-ret, boost::system::system_category()};
       ceph::async::post(std::move(p), ec, bufferlist{});
     } else {
+      // coverity[RESOURCE_LEAK:FALSE]
       (void)p.release();
     }
     return init.result.get();
index 163b242d5c022063167b228ee9f656fd9bdb197b..1716edd0c7193b5cf14e8215690102a933a9098a 100644 (file)
@@ -449,6 +449,7 @@ private:
     } else {
         ldout(conn->cct, 20) << "Kafka publish (no callback): OK" << dendl;
     }
+    // coverity[RESOURCE_LEAK:FALSE]
   }
 
   // the managers thread:
index 0824273e64edc4877c6e7baa5b7e62c3537a8af7..a8f9dbac0554874a3ee8e4230cf507fc6e3bb022 100644 (file)
@@ -418,6 +418,8 @@ RGWKMIPManagerImpl::add_request(RGWKMIPTransceiver *req)
   std::unique_lock l{lock};
   if (going_down)
     return -ECANCELED;
+  // requests is a boost::intrusive::list, which manages pointers and does not copy the instance
+  // coverity[RESOURCE_LEAK:FALSE]
   requests.push_back(*new Request{*req});
   l.unlock();
   if (worker)
index abbd998cfb96de5fe767725355a68e38ee276b0f..70750368f375e12f597b28850b519f4b9c59f8f2 100644 (file)
@@ -133,6 +133,7 @@ RGWPeriodHistory::Impl::Impl(CephContext* cct, Puller* puller,
     history->periods.push_back(current_period);
 
     // insert as our current history
+    // coverity[RESOURCE_LEAK:FALSE]
     current_history = histories.insert(*history).first;
 
     // get a cursor to the current period
@@ -245,6 +246,7 @@ Cursor RGWPeriodHistory::Impl::insert_locked(RGWPeriod&& period)
     // create a new history for this period
     auto history = new History;
     history->periods.emplace_back(std::move(period));
+    // coverity[RESOURCE_LEAK:FALSE]
     histories.insert(last, *history);
 
     i = Set::s_iterator_to(*history);
@@ -294,6 +296,7 @@ Cursor RGWPeriodHistory::Impl::insert_locked(RGWPeriod&& period)
   // create a new history for this period
   auto history = new History;
   history->periods.emplace_back(std::move(period));
+  // coverity[RESOURCE_LEAK:FALSE]
   histories.insert(i, *history);
 
   i = Set::s_iterator_to(*history);