From 14fbad6750e48929229fd671b6ae075f11ccd9d9 Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Fri, 24 Sep 2010 15:24:38 +0000 Subject: QPID-2885: clean up memory leaks on C++ qmf console shutdown. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1000907 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/console/Broker.cpp | 5 +++++ cpp/src/qpid/console/SessionManager.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'cpp/src') diff --git a/cpp/src/qpid/console/Broker.cpp b/cpp/src/qpid/console/Broker.cpp index d2ff8f819e..86a17d4a10 100644 --- a/cpp/src/qpid/console/Broker.cpp +++ b/cpp/src/qpid/console/Broker.cpp @@ -59,6 +59,11 @@ Broker::~Broker() { connThreadBody.shutdown(); connThread.join(); + resetAgents(); + // resetAgents() does not delete the broker agent... + for (AgentMap::iterator iter = agents.begin(); iter != agents.end(); iter++) { + delete iter->second; + } } string Broker::getUrl() const diff --git a/cpp/src/qpid/console/SessionManager.cpp b/cpp/src/qpid/console/SessionManager.cpp index 4f39095a54..80c5959417 100644 --- a/cpp/src/qpid/console/SessionManager.cpp +++ b/cpp/src/qpid/console/SessionManager.cpp @@ -46,6 +46,15 @@ SessionManager::~SessionManager() for (vector::iterator iter = brokers.begin(); iter != brokers.end(); iter++) delete *iter; + + for (map::iterator iter = packages.begin(); + iter != packages.end(); iter++) { + for (Package::ClassMap::iterator citer = iter->second->classes.begin(); + citer != iter->second->classes.end(); + citer++) + delete citer->second; + delete iter->second; + } } Broker* SessionManager::addBroker(client::ConnectionSettings& settings) -- cgit v1.2.1