From: Michael Tokarev Date: Thu, 30 Oct 2014 07:53:02 +0000 (+0300) Subject: virtio-9p-proxy: Fix sockfd leak X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~209^2~493^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=660edd4eda903e32811a4929d1434cceda3284aa;p=sdk%2Femulator%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 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; }