[PATCH linux vdagent 2/2] Avoid leaking udscs file descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a  finding from coverity. In practice it has very little impact
since returning NULL from this function results in the process existing
with an error.

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 src/udscs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/udscs.c b/src/udscs.c
index 64f0307..6e73015 100644
--- a/src/udscs.c
+++ b/src/udscs.c
@@ -450,12 +450,14 @@ struct udscs_server *udscs_create_server(const char *socketname,
     c = bind(fd, (struct sockaddr *)&address, sizeof(address));
     if (c != 0) {
         syslog(LOG_ERR, "bind %s: %m", socketname);
+        close(fd);
         return NULL;
     }
 
     c = listen(fd, 5);
     if (c != 0) {
         syslog(LOG_ERR, "listen: %m");
+        close(fd);
         return NULL;
     }
 
-- 
2.13.6

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]