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: v1.0-rc2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d9474726274d0e1c420f055849a0e3058cad0e4;p=thirdparty%2Fqemu.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 183a9cbbd28..61b22470778 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; }