From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 230483777 for ; Mon, 18 Jul 2016 15:20:24 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 18 Jul 2016 06:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,384,1464678000"; d="scan'208";a="141151901" Received: from sie-lab-214-036.ir.intel.com (HELO silpixa00394365.ir.intel.com) ([10.237.214.36]) by fmsmga004.fm.intel.com with ESMTP; 18 Jul 2016 06:20:19 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: declan.doherty@intel.com, reshma.pattan@intel.com, john.nmcnamara@intel.com, Pablo de Lara Date: Mon, 18 Jul 2016 14:21:04 +0100 Message-Id: <1468848064-19131-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468846036-228978-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1468846036-228978-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3] crypto: fix memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 13:20:25 -0000 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 Acked-by: Reshma Pattan --- 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