aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2014-10-30 10:53:02 +0300
committerMichael Tokarev <mjt@tls.msk.ru>2014-11-02 10:04:34 +0300
commit660edd4eda903e32811a4929d1434cceda3284aa (patch)
tree2e41807b5728b7870ed3e4b4f0fef31696d8585f /hw
parent8ef2b256b94696a3a4bd8aa69a2b0fd7bc246f07 (diff)
virtio-9p-proxy: Fix sockfd leak
If connect() in connect_namedsocket() return false, the sockfd will leak. Plug it. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/9pfs/virtio-9p-proxy.c1
1 files changed, 1 insertions, 0 deletions
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;
}