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 01DA95A9B for ; Wed, 11 May 2016 16:58:22 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 11 May 2016 07:58:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,608,1455004800"; d="scan'208";a="963694948" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga001.fm.intel.com with SMTP; 11 May 2016 07:58:18 -0700 Received: by Sent (sSMTP sendmail emulation); Wed, 11 May 2016 18:01:07 +0200 From: Daniel Mrzyglod To: sergio.gonzalez.monroy@intel.com, david.marchand@6wind.com Cc: dev@dpdk.org, Daniel Mrzyglod Date: Wed, 11 May 2016 18:01:05 +0200 Message-Id: <1462982465-129762-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] eal/linuxapp: fix resource 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: Wed, 11 May 2016 14:58:23 -0000 Fix issue reported by Coverity. Coverity ID 97920 munmap structure of hugepage leaked_storage: Variable hugepage going out of scope leaks the storage it points to. The system resource will not be reclaimed and reused, reducing the future availability of the resource. In rte_eal_hugepage_init: Leak of memory or pointers to system resources Fixes: b6a468ad41d5 ("memory: add --socket-mem option") Signed-off-by: Daniel Mrzyglod --- lib/librte_eal/linuxapp/eal/eal_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c..cd40cc9 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1051,7 +1051,7 @@ int rte_eal_hugepage_init(void) { struct rte_mem_config *mcfg; - struct hugepage_file *hugepage, *tmp_hp = NULL; + struct hugepage_file *hugepage = NULL, *tmp_hp = NULL; struct hugepage_info used_hp[MAX_HUGEPAGE_SIZES]; uint64_t memory[RTE_MAX_NUMA_NODES]; @@ -1374,6 +1374,8 @@ rte_eal_hugepage_init(void) fail: free(tmp_hp); + if (hugepage != NULL) + munmap(hugepage, nr_hugefiles * sizeof(struct hugepage_file)); return -1; } -- 2.5.5