summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-10-08 09:16:44 +0200
committerChris Luke <chris_luke@comcast.com>2018-10-08 12:27:24 +0000
commit3620e61dece82781f0073a2908dfcb24724712a9 (patch)
treee101a3cb7d6bffc565678bcc351be4a999313411
parente2f4e2f175beb6d6490d275049199db7dd61c783 (diff)
Stats: prometheus export coverity errors.
Change-Id: Ibc0a25dcf7d734215e0cffe789b5726f23e1c3d7 Signed-off-by: Ole Troan <ot@cisco.com>
-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);
}