mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 10:01:59 -06:00
plugins: Fix resource leak in connect_socket()
Close the fd when the connect() fails. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Alex Chen <alex.chen@huawei.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20201109082829.87496-2-alex.chen@huawei.com> Message-Id: <20201110192316.26397-2-alex.bennee@linaro.org>
This commit is contained in:
parent
b50ea0d54b
commit
dbb864ba4f
1 changed files with 1 additions and 0 deletions
|
@ -292,6 +292,7 @@ static bool connect_socket(const char *path)
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
|
if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
|
||||||
perror("failed to connect");
|
perror("failed to connect");
|
||||||
|
close(fd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue