]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: fix uninitialized nref in crimson CephContext 67453/head
authorAlexander Indenbaum <aindenba@redhat.com>
Sat, 21 Feb 2026 19:13:50 +0000 (21:13 +0200)
committerAlexander Indenbaum <aindenba@redhat.com>
Sun, 22 Feb 2026 13:59:46 +0000 (15:59 +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;
 };
 }