From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id BCF412C6E for ; Mon, 18 Jul 2016 14:46:30 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 18 Jul 2016 05:46:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,383,1464678000"; d="scan'208";a="1008954056" Received: from sie-lab-214-036.ir.intel.com (HELO silpixa00394365.ir.intel.com) ([10.237.214.36]) by fmsmga001.fm.intel.com with ESMTP; 18 Jul 2016 05:46:28 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: declan.doherty@intel.com, reshma.pattan@intel.com, Pablo de Lara Date: Mon, 18 Jul 2016 13:47:16 +0100 Message-Id: <1468846036-228978-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468843230-205038-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1468843230-205038-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2] 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 12:46:31 -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 --- Changes in v2: - Initialize ret variable to 0 (success) lib/librte_cryptodev/rte_cryptodev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 20e5beb..db809d8 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,10 +187,9 @@ rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params, } } - return 0; - free_kvlist: - rte_kvargs_free(kvlist); + if (kvlist != NULL) + rte_kvargs_free(kvlist); return ret; } -- 2.7.4