From fb9e29d4d0f2f591cd1d706fd3b7334af7d34b84 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 13 Jul 2024 06:12:35 +0200 Subject: [PATCH] queue runner: fix nullptr deref on build exception after releasing a machine reservation --- src/hydra-queue-runner/builder.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hydra-queue-runner/builder.cc b/src/hydra-queue-runner/builder.cc index eecf43c4..782c1710 100644 --- a/src/hydra-queue-runner/builder.cc +++ b/src/hydra-queue-runner/builder.cc @@ -37,11 +37,12 @@ void State::builder(MachineReservation::ptr reservation) try { auto destStore = getDestStore(); + // Might release the reservation. res = doBuildStep(destStore, reservation, activeStep); } catch (std::exception & e) { printMsg(lvlError, "uncaught exception building ā€˜%sā€™ on ā€˜%sā€™: %s", - localStore->printStorePath(reservation->step->drvPath), - reservation->machine->sshName, + localStore->printStorePath(activeStep->step->drvPath), + reservation ? reservation->machine->sshName : std::string("(no machine)"), e.what()); } }