[PATCH] network_thread: Fix memory leak in network_thread

11 views
Skip to first unread message

Shota Shimoyama

unread,
Sep 23, 2026, 9:33:58 PMSep 23
to swup...@googlegroups.com
Elements inserted into the `notifymsgs` queue by network_notifier() are
dequeued via SIMPLEQ_REMOVE_HEAD() in network_thread(). While their
message data was copied, the allocated memory for the dequeued element
was never freed.

Fix this by explicitly calling free() on the dequeued element after
copying its fields.

Reviewed-by: Dominique Martinet <dominique...@atmark-techno.com>
Signed-off-by: Shota Shimoyama <shota.s...@atmark-techno.com>
---
core/network_thread.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/core/network_thread.c b/core/network_thread.c
index 723bdea4..8678ae34 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -511,6 +511,7 @@ void *network_thread (void *data)
sizeof(msg.data.status.desc) - 1);
msg.data.status.current = notification->status;
msg.data.status.error = notification->error;
+ free(notification);
}
pthread_mutex_unlock(&msglock);

--
2.34.1

Stefano Babic

unread,
Sep 28, 2026, 6:33:38 AM (11 days ago) Sep 28
to Shota Shimoyama, swup...@googlegroups.com
Reviewed-by: Stefano Babic <stefan...@swupdate.org>

--
_______________________________________________________________________
Nabla Software Engineering GmbH
Hirschstr. 111A | 86156 Augsburg | Tel: +49 821 45592596
Geschäftsführer : Stefano Babic | HRB 40522 Augsburg
E-Mail: sba...@nabladev.com

Reply all
Reply to author
Forward
0 new messages