From dbb864ba4f7bc419a3ce473aa9436cc41b2e3dfd Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Tue, 10 Nov 2020 19:23:07 +0000 Subject: plugins: Fix resource leak in connect_socket() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close the fd when the connect() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen Signed-off-by: Alex Bennée Message-Id: <20201109082829.87496-2-alex.chen@huawei.com> Message-Id: <20201110192316.26397-2-alex.bennee@linaro.org> --- contrib/plugins/lockstep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index a696673..319bd44 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -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; } -- cgit v1.1