mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-28 12:32:05 -06:00
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:
parent
8ef2b256b9
commit
660edd4eda
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue