aboutsummaryrefslogtreecommitdiff
path: root/qemu-sockets.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-11-11 10:40:07 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-11 12:49:52 -0600
commit9d9474726274d0e1c420f055849a0e3058cad0e4 (patch)
treea4bf92a432cb8f39fc0e798895f9f76ffa050f99 /qemu-sockets.c
parentf2d3476eba17486c42357ba25c36bd26e627d1d7 (diff)
qemu-sockets: Plug fd leak on unix_connect_opts() error path
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-sockets.c')
-rw-r--r--qemu-sockets.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 183a9cbbd2..61b2247077 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -572,6 +572,7 @@ int unix_connect_opts(QemuOpts *opts)
snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);
if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
fprintf(stderr, "connect(unix:%s): %s\n", path, strerror(errno));
+ close(sock);
return -1;
}