From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1FACEA0524; Thu, 2 Jul 2020 11:28:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30A431D718; Thu, 2 Jul 2020 11:28:20 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 682611D711; Thu, 2 Jul 2020 11:28:18 +0200 (CEST) IronPort-SDR: 1NaqPb/DYKwjQ9tSjTr71Zh3uJmdthj39JjYyH7Lmph8TDkJqG1do1ruDFJRz+WCGsP4TYP0HB xlMBVl80qIGw== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="135139094" X-IronPort-AV: E=Sophos;i="5.75,303,1589266800"; d="scan'208";a="135139094" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 02:28:17 -0700 IronPort-SDR: hzpf/geO/0chircluZaTMF1V+d5kQsQ0LLo4o36ZIABL+jMFhNgBtZokK4aMJnE/YWvW9Fp5ua ABh61wa23YeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,303,1589266800"; d="scan'208";a="455460602" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.176]) ([10.67.68.176]) by orsmga005.jf.intel.com with ESMTP; 02 Jul 2020 02:28:14 -0700 To: wangyunjian , dev@dpdk.org Cc: jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: <1593518201-27524-1-git-send-email-wangyunjian@huawei.com> From: Jeff Guo Message-ID: <2706952f-9788-b597-cf68-78f4dd3ed96d@intel.com> Date: Thu, 2 Jul 2020 17:28:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <1593518201-27524-1-git-send-email-wangyunjian@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] eal: fix memory leak when removing event_cb X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" hi, yunjian On 6/30/2020 7:56 PM, wangyunjian wrote: > From: Yunjian Wang > > The event_cb->dev_name is not freed when freeing event_cb, > and this causes a memory leak. > > Fixes: a753e53d517b ("eal: add device event monitor framework") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > lib/librte_eal/common/eal_common_dev.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > index 9e4f09d..4cfdb80 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -526,6 +526,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) > */ > if (event_cb->active == 0) { > TAILQ_REMOVE(&dev_event_cbs, event_cb, next); > + if (event_cb->dev_name) > + free(event_cb->dev_name); > free(event_cb); > ret++; > } else { Could you please to check is there another part need to check memory leak like that, such as in rte_dev_event_callback_register?