There is a problem in the get_threadname in pstree.c. Using the latest version (22.21) At line 808, file = fopen(...). If this fails the routine still tries to
do:
fclose(file);
Where file will be null. This causes a segfault. The fix is simple:
if (file) fclose(file);
at line 822.
Patch [#33] had a few changes around this part of the code and as a side-effect (or intention) fixed this problem another way. It went into the repository at commit [265fa4]
Related
Commit: [265fa4]
Patches:
#33Last edit: Craig Small 2014-12-22
Indeed this fix the crash on fclose() but there could be an other problem as well. After the malloc() for the threadname it might help to set
*threadname = '\0';
as otherwise strncpy() in new_proc() or rename_proc() may crash on random memory within the allocated area to which threadname points to.