]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: fix msg leak in requeue_sent()
authorSage Weil <sage@inktank.com>
Sat, 5 Jan 2013 17:29:50 +0000 (09:29 -0800)
committerSage Weil <sage@inktank.com>
Mon, 7 Jan 2013 04:38:22 +0000 (20:38 -0800)
The sent list owns a reference to each message.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.cc

index ec9dd24045c76c9197e21ac118119fd7eb93e372..bf8c4566d69455fbb0166b722c96f2d53c22422a 100644 (file)
@@ -1070,14 +1070,17 @@ void Pipe::requeue_sent(uint64_t max_acked)
   list<Message*>& rq = out_q[CEPH_MSG_PRIO_HIGHEST];
   while (!sent.empty()) {
     Message *m = sent.back();
+    sent.pop_back();
     if (m->get_seq() > max_acked) {
-      sent.pop_back();
       ldout(msgr->cct,10) << "requeue_sent " << *m << " for resend seq " << out_seq
           << " (" << m->get_seq() << ")" << dendl;
       rq.push_front(m);
       out_seq--;
-    } else
-      sent.clear();
+    } else {
+      ldout(msgr->cct,10) << "requeue_sent " << *m << " for resend seq " << out_seq
+                         << " <= max_acked " << max_acked << ", discarding" << dendl;
+      m->put();
+    }
   }
 }