aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp/stats/stat_segment.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index 43a48707f1c..6a666f5094d 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -335,7 +335,10 @@ vlib_map_stat_segment_init (void)
format_clib_error, clib_mem_get_last_error ());
/* Set size */
if ((ftruncate (mfd, memory_size)) == -1)
- return clib_error_return (0, "stat segment ftruncate failure");
+ {
+ close (mfd);
+ return clib_error_return (0, "stat segment ftruncate failure");
+ }
memaddr = clib_mem_vm_map_shared (0, memory_size, mfd, 0, mem_name);