Otherwise "the state of 'list' and 'stats' are undefined" (as per
get_slabinfo()'s documentation) and free_slabinfo() crashes (a
use-after-free).
memset(&stats, 0, sizeof(struct slab_stat));
if (get_slabinfo(&slab_list, &stats)) {
+ slab_list = NULL;
retval = EXIT_FAILURE;
break;
}
if (is_tty)
tcsetattr(STDIN_FILENO, TCSAFLUSH, &saved_tty);
- free_slabinfo(slab_list);
+ if (slab_list)
+ free_slabinfo(slab_list);
if (!run_once)
endwin();
return retval;