When HOME was unset, nvtop would segfault as in the following trace:
Process terminating with default action of signal 11 (SIGSEGV)
Access not within mapped region at address 0x0
at 0x488B298: strlen (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
by 0x119F33: default_config_path (interface_options.c:48)
by 0x11A5F3: alloc_interface_options_internals (interface_options.c:138)
by 0x10FEBF: main (nvtop.c:209)
We need to handle the unlikely case in which HOME is also unset. On top of that, default_config_path()'s return value has to be checked in the calling function to make sure a default config file's path string is only allocated when != NULL.
When HOME was unset, nvtop would segfault as in the following trace:
Process terminating with default action of signal 11 (SIGSEGV) Access not within mapped region at address 0x0 at 0x488B298: strlen (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so) by 0x119F33: default_config_path (interface_options.c:48) by 0x11A5F3: alloc_interface_options_internals (interface_options.c:138) by 0x10FEBF: main (nvtop.c:209)
We need to handle the unlikely case in which HOME is also unset. On top of that, default_config_path()'s return value has to be checked in the calling function to make sure a default config file's path string is only allocated when != NULL.