You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2017/02/22 16:24:04 UTC

qpid-cpp git commit: QPID-7679: fix DirectExchange memory leak on unbind

Repository: qpid-cpp
Updated Branches:
  refs/heads/master 25e73e5a4 -> f0eaf298d


QPID-7679: fix DirectExchange memory leak on unbind


Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/f0eaf298
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/f0eaf298
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/f0eaf298

Branch: refs/heads/master
Commit: f0eaf298d3b54116cd6ac22fa26d15af5a19b9e0
Parents: 25e73e5
Author: Cliff Jansen <cl...@apache.org>
Authored: Tue Feb 21 17:46:33 2017 -0800
Committer: Cliff Jansen <cl...@apache.org>
Committed: Tue Feb 21 17:46:33 2017 -0800

----------------------------------------------------------------------
 src/qpid/broker/DirectExchange.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/f0eaf298/src/qpid/broker/DirectExchange.cpp
----------------------------------------------------------------------
diff --git a/src/qpid/broker/DirectExchange.cpp b/src/qpid/broker/DirectExchange.cpp
index be66bc2..9aa1cbd 100644
--- a/src/qpid/broker/DirectExchange.cpp
+++ b/src/qpid/broker/DirectExchange.cpp
@@ -137,14 +137,16 @@ bool DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, c
              << " on exchange " << getName() << " origin=" << fedOrigin << ")" );
     {
         Mutex::ScopedLock l(lock);
-        BoundKey& bk = bindings[routingKey];
+        Bindings::iterator it = bindings.find(routingKey);
+        if (it == bindings.end()) return false;
+        BoundKey& bk(it->second);
         if (bk.queues.remove_if(MatchQueue(queue))) {
             propagate = bk.fedBinding.delOrigin(queue->getName(), fedOrigin);
             if (mgmtExchange != 0) {
                 mgmtExchange->dec_bindingCount();
             }
             if (bk.queues.empty()) {
-                bindings.erase(routingKey);
+                bindings.erase(it);
                 if (bindings.empty()) empty = true;
             }
         } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org