summaryrefslogtreecommitdiff
path: root/cpp/src/tests/qpid_stream.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-03-19 17:04:18 +0000
committerGordon Sim <gsim@apache.org>2010-03-19 17:04:18 +0000
commit45b5d1cc1f48ed8f6caef8ee9652f788d69747a5 (patch)
tree285eebffee4dd1252abde2dd39872531565987d3 /cpp/src/tests/qpid_stream.cpp
parentd6de561675087e8b1a6978d82569467c4aeff398 (diff)
downloadqpid-python-45b5d1cc1f48ed8f6caef8ee9652f788d69747a5.tar.gz
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/qpid@925332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/qpid_stream.cpp')
-rw-r--r--cpp/src/tests/qpid_stream.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpp/src/tests/qpid_stream.cpp b/cpp/src/tests/qpid_stream.cpp
index ef0aea52e4..5ed7f84492 100644
--- a/cpp/src/tests/qpid_stream.cpp
+++ b/cpp/src/tests/qpid_stream.cpp
@@ -87,8 +87,8 @@ struct Client : qpid::sys::Runnable
void run()
{
+ Connection connection;
try {
- Connection connection;
connection.open(opts.url);
Session session = connection.newSession();
doWork(session);
@@ -96,6 +96,7 @@ struct Client : qpid::sys::Runnable
connection.close();
} catch(const std::exception& error) {
std::cout << error.what() << std::endl;
+ connection.close();
}
}