提交 660edd4e 编写于 作者: M Michael Tokarev

virtio-9p-proxy: Fix sockfd leak

If connect() in connect_namedsocket() return false, the sockfd will leak.
Plug it.
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
Signed-off-by: NGonglei <arei.gonglei@huawei.com>
上级 8ef2b256
...@@ -1112,6 +1112,7 @@ static int connect_namedsocket(const char *path) ...@@ -1112,6 +1112,7 @@ static int connect_namedsocket(const char *path)
size = strlen(helper.sun_path) + sizeof(helper.sun_family); size = strlen(helper.sun_path) + sizeof(helper.sun_family);
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) { if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
fprintf(stderr, "socket error\n"); fprintf(stderr, "socket error\n");
close(sockfd);
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册