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, Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH] crypto: fix memory leak
Date: Mon, 18 Jul 2016 13:00:30 +0100	[thread overview]
Message-ID: <1468843230-205038-1-git-send-email-pablo.de.lara.guarch@intel.com> (raw)

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>
---
 lib/librte_cryptodev/rte_cryptodev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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

             reply	other threads:[~2016-07-18 12:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 12:00 Pablo de Lara [this message]
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   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
2016-07-22  9:02     ` 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=1468843230-205038-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 \
    /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).