DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Cc: declan.doherty@intel.com, reshma.pattan@intel.com,
	john.nmcnamara@intel.com,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v3] crypto: fix memory leak
Date: Mon, 18 Jul 2016 14:21:04 +0100	[thread overview]
Message-ID: <1468848064-19131-1-git-send-email-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <1468846036-228978-1-git-send-email-pablo.de.lara.guarch@intel.com>

When parsing the parameters for virtual device initialization,
rte_kvargs structure was being freed only if there was an error,
not when parsing was successful.

Coverity issue: 124568

Fixes: f3e764fa2fb7 ("cryptodev: uninline parameter parsing")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---

Changes in v3:
- Removed unnecessary NULL check

Changes in v2:
- Initialized ret variable to 0 (success)

 lib/librte_cryptodev/rte_cryptodev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 20e5beb..fc4123b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -148,8 +148,8 @@ int
 rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params,
 		const char *input_args)
 {
-	struct rte_kvargs *kvlist;
-	int ret;
+	struct rte_kvargs *kvlist = NULL;
+	int ret = 0;
 
 	if (params == NULL)
 		return -EINVAL;
@@ -187,8 +187,6 @@ rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params,
 		}
 	}
 
-	return 0;
-
 free_kvlist:
 	rte_kvargs_free(kvlist);
 	return ret;
-- 
2.7.4

  parent reply	other threads:[~2016-07-18 13:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 12:00 [dpdk-dev] [PATCH] " Pablo de Lara
2016-07-18 12:32 ` Pattan, Reshma
2016-07-18 12:42   ` De Lara Guarch, Pablo
2016-07-18 12:47 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2016-07-18 12:59   ` Pattan, Reshma
2016-07-18 13:00   ` Mcnamara, John
2016-07-18 13:21   ` Pablo de Lara [this message]
2016-07-22  9:02     ` [dpdk-dev] [PATCH v3] " Thomas Monjalon

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=1468848064-19131-1-git-send-email-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.nmcnamara@intel.com \
    --cc=reshma.pattan@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).