proc: fix the potential use-after-free in first_tid()