mem: fix potential double close on map failure
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 16 Apr 2018 15:11:55 +0000 (16:11 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:42:40 +0000 (23:42 +0200)
commit6f0fa9f238320669b024e8f36184b621d9ab2fb3
treeb3406993270f874b62e130f6d345071328e77669
parent5441fcfd874d8d1ac86e38858f61310c63180204
mem: fix potential double close on map failure

We were closing descriptor before checking if mapping has
failed, but if it did, we did a second close afterwards. Fix
it by moving closing descriptor to after we've done all error
checks.

Coverity issue: 272560
Fixes: 2a04139f66b4 ("eal: add single file segments option")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c