From 660edd4eda903e32811a4929d1434cceda3284aa Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Thu, 30 Oct 2014 10:53:02 +0300 Subject: 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 --- hw/9pfs/virtio-9p-proxy.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/9pfs') diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c index b57966d9d8..e6bbb06319 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; } -- cgit v1.2.3