[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/19] contrib/plugins: Close file descriptor on error return
From: |
Alex Bennée |
Subject: |
[PULL 19/19] contrib/plugins: Close file descriptor on error return |
Date: |
Tue, 31 Oct 2023 14:44:01 +0000 |
From: Cong Liu <liucong2@kylinos.cn>
This patch closes the file descriptor fd on error return to avoid
resource leak.
Fixes: ec7ee95db909 ("contrib/plugins: fix coverity warning in lockstep")
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
Message-Id: <20231018025225.1640122-1-liucong2@kylinos.cn>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20231029145033.592566-20-alex.bennee@linaro.org>
diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
index f0cb8792c6..237543b43a 100644
--- a/contrib/plugins/lockstep.c
+++ b/contrib/plugins/lockstep.c
@@ -257,6 +257,7 @@ static bool setup_socket(const char *path)
sockaddr.sun_family = AF_UNIX;
if (g_strlcpy(sockaddr.sun_path, path, pathlen) >= pathlen) {
perror("bad path");
+ close(fd);
return false;
}
@@ -303,6 +304,7 @@ static bool connect_socket(const char *path)
sockaddr.sun_family = AF_UNIX;
if (g_strlcpy(sockaddr.sun_path, path, pathlen) >= pathlen) {
perror("bad path");
+ close(fd);
return false;
}
--
2.39.2
- [PULL 08/19] tests/docker: use debian-all-test-cross for power, (continued)
- [PULL 08/19] tests/docker: use debian-all-test-cross for power, Alex Bennée, 2023/10/31
- [PULL 13/19] tests/docker: use debian-all-test-cross for riscv64, Alex Bennée, 2023/10/31
- [PULL 07/19] tests/docker: move sh4 to use debian-legacy-test-cross, Alex Bennée, 2023/10/31
- [PULL 09/19] tests/docker: use debian-all-test-cross for hppa, Alex Bennée, 2023/10/31
- [PULL 14/19] tests/docker: use debian-all-test-cross for sparc64, Alex Bennée, 2023/10/31
- [PULL 11/19] tests/docker: use debian-all-test-cross for mips64, Alex Bennée, 2023/10/31
- [PULL 15/19] tests/docker: upgrade debian-all-test-cross to bookworm, Alex Bennée, 2023/10/31
- [PULL 12/19] tests/docker: use debian-all-test-cross for mips, Alex Bennée, 2023/10/31
- [PULL 17/19] semihosting: fix memleak at semihosting_arg_fallback, Alex Bennée, 2023/10/31
- [PULL 16/19] gdbstub: Check if gdb_regs is NULL, Alex Bennée, 2023/10/31
- [PULL 19/19] contrib/plugins: Close file descriptor on error return,
Alex Bennée <=
- [PULL 18/19] plugins: Remove an extra parameter, Alex Bennée, 2023/10/31
- Re: [PULL 00/19] Updates for testing, gitlab, gdbstub, plugins and semihosting, Stefan Hajnoczi, 2023/10/31