summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-03-10 21:26:14 +0100
committerNeale Ranns <nranns@cisco.com>2019-03-11 09:08:39 +0000
commit8ae3a53c7a60c0d656c46298509fa40987c8fa8b (patch)
tree7c2527c5333e196f9c206d8625562076dd180686 /src
parenta7427ec6f86cbeba7594f98e41fecab291d66b73 (diff)
VPP-1486: stat segment file descriptor leak
Close the mmap file descriptor at first opportunity. Change-Id: If8faa1de0a57dc7d8abb3eed97861813b841bd92 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vpp-api/client/stat_client.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index 25a37f76da8..761c73f0fb7 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -141,16 +141,19 @@ stat_segment_connect_r (const char *socket_name, stat_client_main_t * sm)
if (fstat (mfd, &st) == -1)
{
+ close (mfd);
perror ("mmap fstat failed");
return -4;
}
if ((memaddr =
mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, mfd, 0)) == MAP_FAILED)
{
+ close (mfd);
perror ("mmap map failed");
return -5;
}
+ close (mfd);
sm->memory_size = st.st_size;
sm->shared_header = memaddr;
sm->directory_vector =