From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from huawei.com (unknown [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id 7A7231BA25; Thu, 26 Oct 2017 10:18:37 +0200 (CEST) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1E38D204E64E0; Thu, 26 Oct 2017 16:18:24 +0800 (CST) Received: from localhost (10.175.126.192) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Thu, 26 Oct 2017 16:16:23 +0800 From: Pengzhen Liu To: CC: , , , , , Date: Thu, 26 Oct 2017 16:52:42 +0800 Message-ID: <1509007962-652-1-git-send-email-liupengzhen3@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.126.192] X-CFilter-Loop: Reflected Subject: [dpdk-stable] [PATCH] net/virtio: fix memory leak X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 08:18:37 -0000 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; } /* 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 -- 1.7.12.4