From 1bd74a020b93f154b2d4129d512f6334387de7c7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 22 Aug 2013 17:46:45 -0700 Subject: [PATCH] mon/MonClient: release pending outgoing messages on shutdown This fixes a small memory leak when we have messages queued for the mon when we shut down. It is harmless except for the valgrind leak check noise that obscures real leaks. Backport: dumpling Signed-off-by: Sage Weil (cherry picked from commit 309569a6d0b7df263654b7f3f15b910a72f2918d) --- src/mon/MonClient.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 299379ac2499e..38bead8f29fb8 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -328,6 +328,12 @@ void MonClient::shutdown() version_requests.erase(version_requests.begin()); } + while (!waiting_for_session.empty()) { + ldout(cct, 20) << __func__ << " discarding pending message " << *waiting_for_session.front() << dendl; + waiting_for_session.front()->put(); + waiting_for_session.pop_front(); + } + monc_lock.Unlock(); if (initialized) { -- 2.39.5