]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: don't leak message when sending to a closed connection
authorSage Weil <sage@newdream.net>
Thu, 12 Aug 2010 18:52:06 +0000 (11:52 -0700)
committerSage Weil <sage@newdream.net>
Thu, 12 Aug 2010 18:55:19 +0000 (11:55 -0700)
src/msg/SimpleMessenger.cc

index 3887faa77ff5b6006d8010696378d83f540561cd..14053a261a7171d407e0e1dd4ae26f3096ff480f 100644 (file)
@@ -436,7 +436,10 @@ int SimpleMessenger::send_message(Message *m, Connection *con)
   if (pipe) {
     submit_message(m, pipe);
     pipe->put();
-  } // else we raced with reaper()
+  } else {
+    // else we raced with reaper()
+    m->put();
+  }
   return 0;
 }
 
@@ -2335,11 +2338,6 @@ bool SimpleMessenger::register_entity(entity_name_t name)
 
 void SimpleMessenger::submit_message(Message *m, Pipe *pipe)
 { 
-  if (!pipe) {
-    m->put();
-    return;
-  }
-
   lock.Lock();
   if (pipe == dispatch_queue.local_pipe) {
     dout(20) << "submit_message " << *m << " local" << dendl;