DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: yuanhan.liu@linux.intel.com, huawei.xie@intel.com,
	john.mcnamara@intel.com, Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [dpdk-dev] [PATCH 3/4] net/virtio-user: fix resource leaks
Date: Wed, 29 Jun 2016 09:05:35 +0000	[thread overview]
Message-ID: <1467191137-65087-4-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1467191137-65087-1-git-send-email-jianfeng.tan@intel.com>

The return value by rte_kvargs_parse is not free(d), which leads
to memory leak.

Coverity issue: 127482

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 8429b2e..8e39adf 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -320,7 +320,7 @@ virtio_user_eth_dev_alloc(const char *name)
 static int
 virtio_user_pmd_devinit(const char *name, const char *params)
 {
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	struct rte_eth_dev *eth_dev;
 	struct virtio_hw *hw;
 	uint64_t queues = VIRTIO_USER_DEF_Q_NUM;
@@ -422,6 +422,8 @@ virtio_user_pmd_devinit(const char *name, const char *params)
 	ret = 0;
 
 end:
+	if (kvlist)
+		rte_kvargs_free(kvlist);
 	if (path)
 		free(path);
 	if (mac_addr)
-- 
2.1.4

  parent reply	other threads:[~2016-06-29  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29  9:05 [dpdk-dev] [PATCH 0/4] net/virtio-user: fix coverity issues Jianfeng Tan
2016-06-29  9:05 ` [dpdk-dev] [PATCH 1/4] net/virtio-user: fix return value not checked Jianfeng Tan
2016-07-01  2:15   ` Yuanhan Liu
2016-07-05 10:14     ` Tan, Jianfeng
2016-07-05 11:31       ` Yuanhan Liu
2016-06-29  9:05 ` [dpdk-dev] [PATCH 2/4] net/virtio-user: fix string overflow Jianfeng Tan
2016-06-29  9:05 ` Jianfeng Tan [this message]
2016-06-29  9:05 ` [dpdk-dev] [PATCH 4/4] net/virtio-user: fix string unterminated Jianfeng Tan

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=1467191137-65087-4-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=yuanhan.liu@linux.intel.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).