From: Michael Tokarev Date: Thu, 30 Oct 2014 07:53:02 +0000 (+0300) Subject: virtio-9p-proxy: Fix sockfd leak X-Git-Tag: v2.2.0-rc0~14^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=660edd4eda903e32811a4929d1434cceda3284aa;p=thirdparty%2Fqemu.git virtio-9p-proxy: Fix sockfd leak If connect() in connect_namedsocket() return false, the sockfd will leak. Plug it. Signed-off-by: Michael Tokarev Signed-off-by: Gonglei --- diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c index b57966d9d88..e6bbb06319a 100644 --- a/hw/9pfs/virtio-9p-proxy.c +++ b/hw/9pfs/virtio-9p-proxy.c @@ -1112,6 +1112,7 @@ static int connect_namedsocket(const char *path) size = strlen(helper.sun_path) + sizeof(helper.sun_family); if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) { fprintf(stderr, "socket error\n"); + close(sockfd); return -1; }