From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 228D01BA56; Thu, 26 Oct 2017 10:30:09 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 353D7D9659; Thu, 26 Oct 2017 08:30:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 353D7D9659 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=maxime.coquelin@redhat.com Received: from [10.36.112.53] (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFE2F8094C; Thu, 26 Oct 2017 08:30:04 +0000 (UTC) To: Pengzhen Liu , thomas@monjalon.net Cc: dev@dpdk.org, zhangsha.zhang@huawei.com, huangjian.huangjian@huawei.com, zangchuanqiang@huawei.com, stable@dpdk.org References: <1509007962-652-1-git-send-email-liupengzhen3@huawei.com> From: Maxime Coquelin Message-ID: Date: Thu, 26 Oct 2017 10:30:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1509007962-652-1-git-send-email-liupengzhen3@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Oct 2017 08:30:08 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix memory leak 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: , X-List-Received-Date: Thu, 26 Oct 2017 08:30:09 -0000 Hi Pengzhen, On 10/26/2017 10:52 AM, Pengzhen Liu wrote: > In function eth_virtio_dev_init(), dynamic memory stored > in "eth_dev->data->mac_addrs" variable and it is not freed when function return, > this is a possible memory leak. > > Fixes: 6b9ed026a870 ("net/virtio: eth_dev->data->mac_addrs is not freed") > Cc: stable@dpdk.org > Signed-off-by: Pengzhen Liu > --- > drivers/net/virtio/virtio_ethdev.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index c85c14d..c450f25 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1587,13 +1587,13 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > if (!hw->virtio_user_dev) { > ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw); > if (ret) > - goto out; > + goto out; I think you missed to squash your patch with the initial one, as tis one only fixes indentation. Could you resend a squashed version, and tag it as v2? Thanks, Maxime > } > > /* reset device and negotiate default features */ > ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES); > if (ret < 0) > - goto out; > + goto out; > > /* Setup interrupt callback */ > if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > @@ -1603,8 +1603,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > return 0; > > out: > - rte_free(eth_dev->data->mac_addrs); > - return ret; > + rte_free(eth_dev->data->mac_addrs); > + return ret; > } > > static int >