From: Markus Armbruster Date: Fri, 11 Nov 2011 09:40:07 +0000 (+0100) Subject: qemu-sockets: Plug fd leak on unix_connect_opts() error path X-Git-Tag: qemu-xen-4.3.0-rc1~2018 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d9474726274d0e1c420f055849a0e3058cad0e4;p=qemu-upstream-4.6-testing.git qemu-sockets: Plug fd leak on unix_connect_opts() error path Spotted by Coverity. Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori --- diff --git a/qemu-sockets.c b/qemu-sockets.c index 183a9cbbd..61b224707 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; }