summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-03-22 15:15:56 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-03-22 15:15:56 +0000
commit7387b11c77ca13b9f411113dcd4599073088e30d (patch)
tree616156b73c2e40bc2532cbc766af3d59331c1114
parentef819492f1af54c9eafb10ec826b585632ebb2d7 (diff)
downloadrabbitmq-server-7387b11c77ca13b9f411113dcd4599073088e30d.tar.gz
fix a possible leak
it's not clear whether we can actually end up in the 'none' branch, but assuming it exists for a reason, we should certainly clear the dict entry there too. We don't actually need to clear the entry in the {value, ...} branch, since handle_confirm will do that. But clearing in all cases is more obviously correct.
-rw-r--r--src/rabbit_amqqueue_process.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 106a9960..bdb6a0b6 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -794,9 +794,10 @@ handle_queue_down(QPid, Reason, State = #q{queue_monitors = QMons,
{ok, _} ->
#resource{name = QName} = qname(State),
rabbit_log:info("DLQ ~p (for ~p) died~n", [QPid, QName]),
+ State1 = State#q{queue_monitors = dict:erase(QPid, QMons)},
case gb_trees:lookup(QPid, UQM) of
none ->
- noreply(State);
+ noreply(State1);
{value, MsgSeqNosSet} ->
case rabbit_misc:is_abnormal_termination(Reason) of
true -> rabbit_log:warning(
@@ -804,9 +805,7 @@ handle_queue_down(QPid, Reason, State = #q{queue_monitors = QMons,
[gb_sets:size(MsgSeqNosSet)]);
false -> ok
end,
- handle_confirm(gb_sets:to_list(MsgSeqNosSet), QPid,
- State#q{queue_monitors =
- dict:erase(QPid, QMons)})
+ handle_confirm(gb_sets:to_list(MsgSeqNosSet), QPid, State1)
end
end.