discover/boot: Fix use-after-free in boot()