Fix use-after-free detected by ASan bootstrap.