From patchwork Sat Apr 27 03:04:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2496391 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 952DADF230 for ; Sat, 27 Apr 2013 03:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752907Ab3D0DEq (ORCPT ); Fri, 26 Apr 2013 23:04:46 -0400 Received: from mga14.intel.com ([143.182.124.37]:3661 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097Ab3D0DEq (ORCPT ); Fri, 26 Apr 2013 23:04:46 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 26 Apr 2013 20:04:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,562,1363158000"; d="scan'208";a="233392491" Received: from zyan5-mobl.sh.intel.com ([10.239.13.107]) by AZSMGA002.ch.intel.com with ESMTP; 26 Apr 2013 20:04:44 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, joao.luis@inktank.com Cc: "Yan, Zheng" Subject: [PATCH] mon: Fix leak of context Date: Sat, 27 Apr 2013 11:04:38 +0800 Message-Id: <1367031878-7078-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" Use Context::complete() to finish context, it frees the context after executing Context::finish(). Signed-off-by: Yan, Zheng --- src/mon/Paxos.cc | 2 +- src/mon/Paxos.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 21b9343..46eaf88 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -805,7 +805,7 @@ void Paxos::finish_queued_proposal() << " to finish" << dendl; proposals.pop_front(); - proposal->finish(0); + proposal->complete(0); } } diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 8fcf66b..ca467ce 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -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; + } } }; /**