mem: fix resource leak on map failure
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 16 Apr 2018 14:40:02 +0000 (15:40 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:42:40 +0000 (23:42 +0200)
Coverity issue: 272601
Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/linuxapp/eal/eal_memory.c

index fadc1de..9351e84 100644 (file)
@@ -1750,6 +1750,7 @@ eal_legacy_hugepage_attach(void)
                if (map_addr == MAP_FAILED) {
                        RTE_LOG(ERR, EAL, "Could not map %s: %s\n",
                                hf->filepath, strerror(errno));
+                       close(fd);
                        goto error;
                }