From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4F0518D95 for ; Fri, 6 Nov 2015 18:40:44 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 06 Nov 2015 09:40:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,252,1444719600"; d="scan'208";a="679866369" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 06 Nov 2015 09:40:43 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id tA6HefQc016384; Fri, 6 Nov 2015 17:40:41 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id tA6HefY7009620; Fri, 6 Nov 2015 17:40:41 GMT Received: (from jmcnam2@localhost) by sivswdev02.ir.intel.com with id tA6HefZ9009615; Fri, 6 Nov 2015 17:40:41 GMT From: John McNamara To: bruce.richardson@intel.com Date: Fri, 6 Nov 2015 17:40:39 +0000 Message-Id: <1446831639-9576-1-git-send-email-john.mcnamara@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446830917-7376-1-git-send-email-john.mcnamara@intel.com> References: <1446830917-7376-1-git-send-email-john.mcnamara@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2] ring: fix minor memory free issue 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: Fri, 06 Nov 2015 17:40:44 -0000 Fix minor memory free issue in error clean-up. Fixes: 651c505af862 ("ring: enhance device setup from rings") Reported-by Coverity (CID 119258) Signed-off-by: John McNamara --- V2: * Add fixline. drivers/net/ring/rte_eth_ring.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index cc60008..b91a643 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -363,9 +363,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], return data->port_id; error: - rte_free(data->rx_queues); - rte_free(data->tx_queues); - rte_free(data); + if (data) { + rte_free(data->rx_queues); + rte_free(data->tx_queues); + rte_free(data); + } rte_free(internals); return -1; -- 1.8.1.4