msgr: Fix crash in policy.throttler->get(message_size) when message_size == 0
diff mbox

Message ID 4C1B6FB6.6020606@gmail.com
State New, archived
Headers show

Commit Message

Simone Gotti June 18, 2010, 1:08 p.m. UTC
None

Patch
diff mbox

diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc
index a30e075..c15fa04 100644
--- a/src/msg/SimpleMessenger.cc
+++ b/src/msg/SimpleMessenger.cc
@@ -1746,9 +1746,10 @@  Message *SimpleMessenger::Pipe::read_message()
        << messenger->message_throttler.get_max() << dendl;
   uint64_t message_size = header.front_len  + header.middle_len
     + header.data_len;
-  if (message_size)
+  if (message_size) {
     messenger->message_throttler.get(message_size);
-  if (policy.throttler) policy.throttler->get(message_size);
+    if (policy.throttler) policy.throttler->get(message_size);
+  }
 
   // read front
   bufferlist front;