[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/17] contrib/plugins: Close file descriptor on error return
From: |
Alex Bennée |
Subject: |
[PATCH 17/17] contrib/plugins: Close file descriptor on error return |
Date: |
Sat, 28 Oct 2023 11:33:11 +0100 |
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>
---
contrib/plugins/lockstep.c | 2 ++
1 file changed, 2 insertions(+)
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
- [PATCH 01/17] tests/vm/openbsd: Use the system dtc package, (continued)
- [PATCH 01/17] tests/vm/openbsd: Use the system dtc package, Alex Bennée, 2023/10/28
- [PATCH 08/17] tests/docker: use debian-all-test-cross for m68k, Alex Bennée, 2023/10/28
- [PATCH 10/17] tests/docker: use debian-all-test-cross for mips, Alex Bennée, 2023/10/28
- [PATCH 06/17] tests/docker: use debian-all-test-cross for power, Alex Bennée, 2023/10/28
- [PATCH 05/17] tests/docker: move sh4 to use debian-legacy-test-cross, Alex Bennée, 2023/10/28
- [PATCH 14/17] gdbstub: Check if gdb_regs is NULL, Alex Bennée, 2023/10/28
- [PATCH 13/17] tests/docker: upgrade debian-all-test-cross to bookworm, Alex Bennée, 2023/10/28
- [PATCH 15/17] semihosting: fix memleak at semihosting_arg_fallback, Alex Bennée, 2023/10/28
- [PATCH 11/17] tests/docker: use debian-all-test-cross for riscv64, Alex Bennée, 2023/10/28
- [PATCH 12/17] tests/docker: use debian-all-test-cross for sparc64, Alex Bennée, 2023/10/28
- [PATCH 17/17] contrib/plugins: Close file descriptor on error return,
Alex Bennée <=
- [PATCH 16/17] plugins: Remove an extra parameter, Alex Bennée, 2023/10/28