[PATCH] iproute: Fix handle leak in iproute_flush_cache()

Maks Mishin maks.mishinfz at gmail.com
Thu Aug 22 17:52:08 UTC 2024


The file descriptor `flush_fd` lost when return from function.

Found by the static analyzer Svace.

Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
 networking/libiproute/iproute.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index cd77f642f..9bbcb3dec 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -749,6 +749,7 @@ static void iproute_flush_cache(void)
 
 	if (write(flush_fd, "-1", 2) < 2) {
 		bb_simple_perror_msg("can't flush routing cache");
+		close(flush_fd);
 		return;
 	}
 	close(flush_fd);
-- 
2.30.2



More information about the busybox mailing list