From f471650dc586709ff8d27937efd363421fc2e591 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Thu, 3 Oct 2024 19:13:58 +1000 Subject: [PATCH] library: Fix memory leak in procps_users Need to free the sesions_list after using it, this was introduced by me when checking the session class. Thanks to Thorsten Kukuk from SUSE (All capitals) for catching this and the patch. References: commit 734930e4766860b7e57f0a3ae7d7f908f5d56153 https://www.freelists.org/post/procps/New-procps-release-soon,10 Signed-off-by: Craig Small --- library/uptime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/uptime.c b/library/uptime.c index 5acbd4bc..5c3a3d37 100644 --- a/library/uptime.c +++ b/library/uptime.c @@ -91,6 +91,9 @@ PROCPS_EXPORT int procps_users(void) numuser++; free(class); } + for (i = 0; i < sessions; i++) + free(sessions_list[i]); + free(sessions_list); return numuser; } }