From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4F553952 for ; Mon, 18 Jul 2016 14:00:07 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 18 Jul 2016 04:59:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,383,1464678000"; d="scan'208";a="1023880520" Received: from sie-lab-214-036.ir.intel.com (HELO silpixa00394365.ir.intel.com) ([10.237.214.36]) by fmsmga002.fm.intel.com with ESMTP; 18 Jul 2016 04:59:47 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: declan.doherty@intel.com, Pablo de Lara Date: Mon, 18 Jul 2016 13:00:30 +0100 Message-Id: <1468843230-205038-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] 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:00:07 -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 --- 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