]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
test/mon/test_election: fix memory leaks in Owner and ConnectionTracker
authorKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 11:16:02 +0000 (19:16 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 11:22:01 +0000 (19:22 +0800)
commit393c44fc442d8eb8b42260631db2ab7a931650be
treedbe00cda63270d5c12dba1df73103e37f1c92651
parent6dbabcb4c2ce5257d561c76d3187b3c3a67c346a
test/mon/test_election: fix memory leaks in Owner and ConnectionTracker

Previously, Owner and ConnectionTracker instances were leaked when
electors were removed from the map while still being referenced by
lambda captures. And ASan rightly pointed this out when running
connectivity.handles_removing_ranks test.

Use shared_ptr to manage their lifecycles, ensuring proper cleanup
even when instances are captured by lambdas after removal from the
electors map.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/test/mon/test_election.cc