From ed9e0f6f6685439791d3af2985ff36a9707ce5e1 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 19 Mar 2010 17:04:18 +0000 Subject: QPID-664: Prevent dangling pointers when receiver/sender handles stay in scope after connection/session handles goes out of scope. This change require connections to be closed explicitly to avoid leaking memory. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@925332 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/examples/messaging/client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/examples/messaging/client.cpp') diff --git a/qpid/cpp/examples/messaging/client.cpp b/qpid/cpp/examples/messaging/client.cpp index 4d68d7c575..3f7afb5e3e 100644 --- a/qpid/cpp/examples/messaging/client.cpp +++ b/qpid/cpp/examples/messaging/client.cpp @@ -39,8 +39,8 @@ using std::string; int main(int argc, char** argv) { const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672"; + Connection connection; try { - Connection connection; connection.open(url); Session session = connection.newSession(); @@ -70,6 +70,7 @@ int main(int argc, char** argv) { return 0; } catch(const std::exception& error) { std::cout << error.what() << std::endl; + connection.close(); } return 1; } -- cgit v1.2.1