From 9d9474726274d0e1c420f055849a0e3058cad0e4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 11 Nov 2011 10:40:07 +0100 Subject: [PATCH] qemu-sockets: Plug fd leak on unix_connect_opts() error path Spotted by Coverity. Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori --- qemu-sockets.c | 1 + 1 file changed, 1 insertion(+) 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; }