DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pengzhen Liu <liupengzhen3@huawei.com>
To: <thomas@monjalon.net>
Cc: <dev@dpdk.org>, <liupengzhen3@huawei.com>,
	<zhangsha.zhang@huawei.com>, <huangjian.huangjian@huawei.com>,
	<zangchuanqiang@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/virtio: fix memory leak
Date: Thu, 26 Oct 2017 16:52:42 +0800	[thread overview]
Message-ID: <1509007962-652-1-git-send-email-liupengzhen3@huawei.com> (raw)

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 <liupengzhen3@huawei.com>
---
 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

             reply	other threads:[~2017-10-26  8:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26  8:52 Pengzhen Liu [this message]
2017-10-26  8:30 ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2017-10-27  3:54 Pengzhen Liu
2017-10-26 14:42 Pengzhen Liu
2017-10-26  9:04 Pengzhen Liu
2017-10-26  7:32 Pengzhen Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509007962-652-1-git-send-email-liupengzhen3@huawei.com \
    --to=liupengzhen3@huawei.com \
    --cc=dev@dpdk.org \
    --cc=huangjian.huangjian@huawei.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=zangchuanqiang@huawei.com \
    --cc=zhangsha.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).