[PATCH] Missing close() in error branch of progress_bar_thread

5 views
Skip to first unread message

Stefano Babic

unread,
Nov 21, 2025, 8:36:33 AM (12 days ago) Nov 21
to swup...@googlegroups.com, Stefano Babic, Michael Glembotzki
In case of OOM, close() is not called and this cause a file descriptor
leak.

Signed-off-by: Stefano Babic <stefan...@swupdate.org>
Reported-by: Michael Glembotzki <Michael.G...@iris-sensing.com>
---
core/progress_thread.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/core/progress_thread.c b/core/progress_thread.c
index 305ca3e6..f3ab0dda 100644
--- a/core/progress_thread.c
+++ b/core/progress_thread.c
@@ -333,6 +333,7 @@ void *progress_bar_thread (void __attribute__ ((__unused__)) *data)
conn = (struct progress_conn *)calloc(1, sizeof(*conn));
if (!conn) {
ERROR("Out of memory, skipping...");
+ close(connfd);
continue;
}
conn->sockfd = connfd;
--
2.43.0

Reply all
Reply to author
Forward
0 new messages