]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common: fix uninitialized nref in crimson CephContext
authorAlexander Indenbaum <aindenba@redhat.com>
Sat, 21 Feb 2026 19:13:50 +0000 (21:13 +0200)
committerAlexander Indenbaum <aindenba@redhat.com>
Mon, 23 Feb 2026 11:17:51 +0000 (13:17 +0200)
Initialize nref(1) in the constructor so put() correctly releases
the context. LeakSanitizer reports a leak.

Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
src/common/ceph_context.h

index fce8492ff67ec870bf0d190f0e3c4224b9ba99fc..a0e0cf9b526ab29d4c9791b3b3acf08b729922fb 100644 (file)
@@ -101,7 +101,7 @@ public:
   void put();
 private:
   std::unique_ptr<CryptoRandom> _crypto_random;
-  unsigned nref;
+  unsigned nref = 1;
   ceph::PluginRegistry* _plugin_registry;
 };
 }