aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-02-16 01:06:22 +0100
committerNeale Ranns <neale@graphiant.com>2021-02-16 09:15:40 +0000
commit445d1100587fd3fe533bd201877794555f9593b5 (patch)
treeb8259e0eee77798d7ba54d50d7a3bc5c3182b493
parent5993a34a12cb41f83ced26893b977b4eb2947708 (diff)
stats: coverity errors leaking fd
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I21368e37d70c5a64babd904bcf5f79339a5ab064 Signed-off-by: Ole Troan <ot@cisco.com>
-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);