From a2203ef07e39ee80172f609c79cdd2456295e647 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 18 Jan 2012 10:38:39 +0100 Subject: [PATCH 45/52] qemu-sockets: Plug fd leak on unix_connect_opts() error path RH-Author: Markus Armbruster Message-id: <1326883126-22053-46-git-send-email-armbru@redhat.com> Patchwork-id: 36597 O-Subject: [RHEL-6.3 PATCH qemu-kvm 45/52] qemu-sockets: Plug fd leak on unix_connect_opts() error path Bugzilla: 758194 RH-Acked-by: Miroslav Rezanina RH-Acked-by: Laszlo Ersek RH-Acked-by: Amit Shah Spotted by Coverity. Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori (cherry picked from commit 9d9474726274d0e1c420f055849a0e3058cad0e4) --- qemu-sockets.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- qemu-sockets.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/qemu-sockets.c b/qemu-sockets.c index 70419e9..b0e4aad 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; } -- 1.7.7.5