aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vpp/app/vpp_prometheus_export.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vpp/app/vpp_prometheus_export.c b/src/vpp/app/vpp_prometheus_export.c
index 8d09bc209a3..b12ce6f30d2 100644
--- a/src/vpp/app/vpp_prometheus_export.c
+++ b/src/vpp/app/vpp_prometheus_export.c
@@ -188,6 +188,7 @@ start_listen (u16 port)
if (listenfd == -1)
{
perror ("Failed opening socket");
+ return -1;
}
int rv =
@@ -195,6 +196,8 @@ start_listen (u16 port)
if (rv < 0)
{
perror ("Failed setsockopt");
+ close (listenfd);
+ return -1;
}
memset (&serveraddr, 0, sizeof (serveraddr));
@@ -205,11 +208,13 @@ start_listen (u16 port)
if (bind (listenfd, (struct sockaddr *) &serveraddr, addrlen) < 0)
{
fprintf (stderr, "bind() error %s\n", strerror (errno));
+ close (listenfd);
return -1;
}
if (listen (listenfd, 1000000) != 0)
{
fprintf (stderr, "listen() error for %s\n", strerror (errno));
+ close (listenfd);
return -1;
}
return listenfd;
@@ -312,6 +317,7 @@ main (int argc, char **argv)
}
stat_segment_disconnect ();
+ close (fd);
exit (0);
}