aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/client/stat_client.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index a539fbaa4e6..d415972de68 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -102,12 +102,14 @@ stat_segment_connect (char *socket_name)
if (connect (sock, (struct sockaddr *) &un, sizeof (struct sockaddr_un)) <
0)
{
+ close (sock);
perror ("connect");
return -1;
}
if ((mfd = recv_fd (sock)) < 0)
{
+ close (sock);
fprintf (stderr, "Receiving file descriptor failed\n");
return -1;
}
@@ -119,12 +121,14 @@ stat_segment_connect (char *socket_name)
if (fstat (mfd, &st) == -1)
{
+ close (sock);
perror ("mmap");
return -1;
}
if ((memaddr =
mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, mfd, 0)) == MAP_FAILED)
{
+ close (sock);
perror ("mmap");
return -1;
}