1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Merge pull request #13761 from xokdvium/fix-dangling-pointers

libstore: Fix dangling pointers in DerivationGoal constructors
This commit is contained in:
Sergei Zimmerman 2025-08-15 17:03:49 +03:00 committed by GitHub
commit c736db5320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,11 +34,10 @@ DerivationGoal::DerivationGoal(
, drvPath(drvPath) , drvPath(drvPath)
, wantedOutput(wantedOutput) , wantedOutput(wantedOutput)
, outputHash{[&] { , outputHash{[&] {
if (auto * mOutputHash = get(staticOutputHashes(worker.evalStore, drv), wantedOutput)) auto outputHashes = staticOutputHashes(worker.evalStore, drv);
if (auto * mOutputHash = get(outputHashes, wantedOutput))
return *mOutputHash; return *mOutputHash;
else throw Error("derivation '%s' does not have output '%s'", worker.store.printStorePath(drvPath), wantedOutput);
throw Error(
"derivation '%s' does not have output '%s'", worker.store.printStorePath(drvPath), wantedOutput);
}()} }()}
, buildMode(buildMode) , buildMode(buildMode)
{ {