session: fix use-after-free in input node