ss: fix directory leak when -T option is used
Subsystems (2)
PATCH 1/1 ss: fix directory leak when -T option is used
To get information about threads used in a process, the /proc/$PID/task directory content is analyzed by ss code. However, the opened 'dirent' object is not closed after use, leading to memory leaks. Add missing closedir call in 'user_ent_hash_build' to avoid it.
Detected by valgrind: "valgrind ./misc/ss -T"
--- misc/ss.c | 1 + 1 file changed, 1 insertion(+)
misc/ss.c +1 -0
@@ -678,6 +678,7 @@ static void user_ent_hash_build(void)snprintf (name + nameoff,sizeof (name) - nameoff,"%d/" , tid);user_ent_hash_build_task (name, pid, tid); } +closedir (task_dir); } }closedir (dir);
Signature · 1 line
2.30.2
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:
Quoted 8 lines · On Sat, 21 Oct 2023 10:44:08 +0200 you wrote:
To get information about threads used in a process, the
/proc/$PID/taskdirectory content is analyzed by ss code. However, the opened 'dirent' object is not closed after use, leading to memory leaks. Add missing closedir call in 'user_ent_hash_build' to avoid it.Detected by valgrind: "valgrind ./misc/ss -T"
[...]
Here is the summary with links:
- [iproute2] ss: fix directory leak when -T option is used
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=d233ff0f984a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html