From 445d1100587fd3fe533bd201877794555f9593b5 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Tue, 16 Feb 2021 01:06:22 +0100 Subject: stats: coverity errors leaking fd Type: fix Signed-off-by: Ole Troan Change-Id: I21368e37d70c5a64babd904bcf5f79339a5ab064 Signed-off-by: Ole Troan --- src/vpp/stats/stat_segment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit 1.2.3-korg