Skip to contentSkip to conversation

mon: Fix leak of context

PATCH New Yan, Zheng 1 participant 1 message Apr 27, 2013

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 mon: Fix leak of context

From: "Yan, Zheng" <[email protected]>

Use Context::complete() to finish context, it frees the context after executing Context::finish().

---
 src/mon/Paxos.cc | 2 +-
 src/mon/Paxos.h  | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
src/mon/Paxos.cc +1 -1
index 21b9343..46eaf88 100644
@@ -805,7 +805,7 @@ void Paxos::finish_queued_proposal()
 	     << " to finish" << dendl;
 
     proposals.pop_front();
-    proposal->finish(0);
+    proposal->complete(0);
   }
 }
 
src/mon/Paxos.h +4 -2
index 8fcf66b..ca467ce 100644
@@ -642,8 +642,10 @@ public:
       { }
 
     void finish(int r) {
-      if (proposer_context)
-        proposer_context->finish(r);
+      if (proposer_context) {
+	proposer_context->complete(r);
+	proposer_context = NULL;
+      }
     }
   };
   /**
Signature · 1 line
1.8.1.4