summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/qpid_send.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
commited9e0f6f6685439791d3af2985ff36a9707ce5e1 (patch)
treec416cd44bcf1bae0f7468ad6c9a750bc50bd1035 /qpid/cpp/src/tests/qpid_send.cpp
parent066c7ab4a285748e824fd4dfe1a11bf4f133c29f (diff)
downloadqpid-python-ed9e0f6f6685439791d3af2985ff36a9707ce5e1.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@925332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/qpid_send.cpp')
-rw-r--r--qpid/cpp/src/tests/qpid_send.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/qpid_send.cpp b/qpid/cpp/src/tests/qpid_send.cpp
index 50e6c4371a..a8b0241a1d 100644
--- a/qpid/cpp/src/tests/qpid_send.cpp
+++ b/qpid/cpp/src/tests/qpid_send.cpp
@@ -181,8 +181,8 @@ int main(int argc, char ** argv)
{
Options opts;
if (opts.parse(argc, argv)) {
+ Connection connection(opts.connectionOptions);
try {
- Connection connection(opts.connectionOptions);
connection.open(opts.url);
std::auto_ptr<FailoverUpdates> updates(opts.failoverUpdates ? new FailoverUpdates(connection) : 0);
Session session = connection.newSession(opts.tx > 0);
@@ -230,6 +230,7 @@ int main(int argc, char ** argv)
return 0;
} catch(const std::exception& error) {
std::cout << "Failed: " << error.what() << std::endl;
+ connection.close();
}
}
return 1;