mirror of
https://github.com/xemu-project/xemu.git
synced 2025-01-19 10:24:37 +00: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
@ -292,6 +292,7 @@ static bool connect_socket(const char *path)
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
|
||||
perror("failed to connect");
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user