From ad1285e1deed4a4ce3cabd52500f618cecebe436 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 11 Feb 2009 14:34:07 +0000 Subject: Fix memory leak in cluster code. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@743346 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Connection.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/cluster/Connection.cpp') diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp index 3f331978ca..d97a1b6c68 100644 --- a/cpp/src/qpid/cluster/Connection.cpp +++ b/cpp/src/qpid/cluster/Connection.cpp @@ -77,11 +77,15 @@ void Connection::init() { QPID_LOG(debug, cluster << " new connection: " << *this); if (isLocalClient()) { cluster.addLocalConnection(this); - if (cluster.getReadMax()) - output.giveReadCredit(cluster.getReadMax()); + giveReadCredit(cluster.getReadMax()); } } +void Connection::giveReadCredit(int credit) { + if (cluster.getReadMax() && credit) + output.giveReadCredit(credit); +} + Connection::~Connection() { QPID_LOG(debug, cluster << " deleted connection: " << *this); } @@ -141,8 +145,7 @@ void Connection::deliveredFrame(const EventFrame& f) { { connection.received(const_cast(f.frame)); // Pass to broker connection. } - if (cluster.getReadMax() && f.readCredit) - output.giveReadCredit(f.readCredit); + giveReadCredit(f.readCredit); } // A local connection is closed by the network layer. -- cgit v1.2.1