summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-10-30 20:33:46 +0000
committerAlan Conway <aconway@apache.org>2009-10-30 20:33:46 +0000
commit6fa6fd99a004c98533f533dc52933c3cbc3c2674 (patch)
treebeda4c61f66c527f0635060df1f68a30b5334893 /cpp
parent4554dcd498ee2e446795edb5315ec3c9bf142615 (diff)
downloadqpid-python-6fa6fd99a004c98533f533dc52933c3cbc3c2674.tar.gz
Fix memory leak in testCoincidentErrors due to un-joined connector thread.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@831446 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp10
-rw-r--r--cpp/src/tests/BrokerFixture.h1
-rw-r--r--cpp/src/tests/PartialFailure.cpp4
3 files changed, 11 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index e4e7b2f5c2..4f35639c71 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -156,8 +156,14 @@ void ConnectionImpl::open()
handler.setRcvTimeoutTask(heartbeatTask);
theTimer().add(heartbeatTask);
}
-
- handler.waitForOpen();
+
+ try {
+ handler.waitForOpen();
+ } catch (...) {
+ // Make sure the connector thread is joined.
+ connector->close();
+ throw;
+ }
// If the SASL layer has provided an "operational" userId for the connection,
// put it in the negotiated settings.
diff --git a/cpp/src/tests/BrokerFixture.h b/cpp/src/tests/BrokerFixture.h
index 5eb6858491..566fbda406 100644
--- a/cpp/src/tests/BrokerFixture.h
+++ b/cpp/src/tests/BrokerFixture.h
@@ -94,6 +94,7 @@ struct BrokerFixture : private boost::noncopyable {
struct LocalConnection : public qpid::client::Connection {
LocalConnection(uint16_t port) { open("localhost", port); }
LocalConnection(const qpid::client::ConnectionSettings& s) { open(s); }
+ ~LocalConnection() { close(); }
};
/** A local client connection via a socket proxy. */
diff --git a/cpp/src/tests/PartialFailure.cpp b/cpp/src/tests/PartialFailure.cpp
index b5772607b2..21c6c5c724 100644
--- a/cpp/src/tests/PartialFailure.cpp
+++ b/cpp/src/tests/PartialFailure.cpp
@@ -98,8 +98,8 @@ QPID_AUTO_TEST_CASE(testCoincidentErrors) {
async(c1.session).messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception]", "q"));
int alive=0;
- try { Client c00(cluster[0], "c00"); ++alive; } catch (...) {}
- try { Client c11(cluster[1], "c11"); ++alive; } catch (...) {}
+ try { Client c00(cluster[0], "c00"); ++alive; c00.close(); } catch (...) {}
+ try { Client c11(cluster[1], "c11"); ++alive; c11.close(); } catch (...) {}
BOOST_CHECK_EQUAL(alive, 1);