diff options
| author | Alan Conway <aconway@apache.org> | 2008-08-15 22:40:30 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-08-15 22:40:30 +0000 |
| commit | a89ff937607b452a1b890861700eea08e08e7724 (patch) | |
| tree | a1bc1cf7404c71a0219a585aaa7aa6dcfbb542d8 /cpp/src/qpid/cluster/Cluster.cpp | |
| parent | 828592ed28dc68137c007dbc8ec92d6826cab929 (diff) | |
| download | qpid-python-a89ff937607b452a1b890861700eea08e08e7724.tar.gz | |
Fix memory leak in Cluster and enable valgrind in ais_check
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@686409 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Cluster.cpp')
| -rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 84edfa201d..05ab9148b5 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -87,13 +87,21 @@ Cluster::Cluster(const std::string& name_, const Url& url_, broker::Broker& b) : mcastQueue.start(poller); } -Cluster::~Cluster() {} +Cluster::~Cluster() { + for (ShadowConnectionMap::iterator i = shadowConnectionMap.begin(); + i != shadowConnectionMap.end(); + ++i) + { + i->second->dirtyClose(); + } + std::for_each(localConnectionSet.begin(), localConnectionSet.end(), boost::bind(&ConnectionInterceptor::dirtyClose, _1)); +} // local connection initializes plugins void Cluster::initialize(broker::Connection& c) { bool isLocal = &c.getOutput() != &shadowOut; if (isLocal) - new ConnectionInterceptor(c, *this); + localConnectionSet.insert(new ConnectionInterceptor(c, *this)); } void Cluster::leave() { @@ -260,6 +268,8 @@ void Cluster::handleMethod(Id from, ConnectionInterceptor* connection, AMQMethod case CLUSTER_CONNECTION_CLOSE_METHOD_ID: { if (!connection->isLocal()) shadowConnectionMap.erase(connection->getShadowId()); + else + localConnectionSet.erase(connection); connection->deliverClosed(); break; } |
