diff options
| author | Gordon Sim <gsim@apache.org> | 2010-03-19 17:04:18 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2010-03-19 17:04:18 +0000 |
| commit | ed9e0f6f6685439791d3af2985ff36a9707ce5e1 (patch) | |
| tree | c416cd44bcf1bae0f7468ad6c9a750bc50bd1035 /qpid/cpp/examples/messaging/spout.cpp | |
| parent | 066c7ab4a285748e824fd4dfe1a11bf4f133c29f (diff) | |
| download | qpid-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/examples/messaging/spout.cpp')
| -rw-r--r-- | qpid/cpp/examples/messaging/spout.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qpid/cpp/examples/messaging/spout.cpp b/qpid/cpp/examples/messaging/spout.cpp index cbb6b52b34..4819c6bc00 100644 --- a/qpid/cpp/examples/messaging/spout.cpp +++ b/qpid/cpp/examples/messaging/spout.cpp @@ -156,8 +156,8 @@ int main(int argc, char** argv) { Options options(argv[0]); if (options.parse(argc, argv)) { + Connection connection(options.connectionOptions); try { - Connection connection(options.connectionOptions); connection.open(options.url); Session session = connection.newSession(); Sender sender = session.createSender(options.address); @@ -183,6 +183,7 @@ int main(int argc, char** argv) return 0; } catch(const std::exception& error) { std::cout << error.what() << std::endl; + connection.close(); } } return 1; |
