diff options
author | Maxim Petrov <mmrmaximuzz@gmail.com> | 2023-10-21 10:44:08 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2023-10-21 09:41:55 -0700 |
commit | d233ff0f984a1f9d0b166701b19e1897b05812d6 (patch) | |
tree | d16040eeee70a573e8e077ed04b67d5885da2157 | |
parent | 575322b09c3c6bc1806f2faa31edcfb64df302bb (diff) | |
download | iproute2-d233ff0f984a1f9d0b166701b19e1897b05812d6.tar.gz |
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"
Fixes: e2267e68b9b5 ("ss: Introduce -T, --threads option")
Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | misc/ss.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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); |