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>
This commit is contained in:
Michael Tokarev 2014-10-30 10:53:02 +03:00
parent 8ef2b256b9
commit 660edd4eda

View file

@ -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;
}