menu: Fix use after free case