Skip to content

Commit 660edd4

Browse files
author
Michael Tokarev
committed
virtio-9p-proxy: Fix sockfd leak
If connect() in connect_namedsocket() return false, the sockfd will leak. Plug it. Signed-off-by: Michael Tokarev <[email protected]> Signed-off-by: Gonglei <[email protected]>
1 parent 8ef2b25 commit 660edd4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

hw/9pfs/virtio-9p-proxy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ static int connect_namedsocket(const char *path)
11121112
size = strlen(helper.sun_path) + sizeof(helper.sun_family);
11131113
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
11141114
fprintf(stderr, "socket error\n");
1115+
close(sockfd);
11151116
return -1;
11161117
}
11171118

0 commit comments

Comments
 (0)