From f5954e2d940c3a41a6ed0cad45660e254eb381a3 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 24 Jul 2012 12:05:27 -0400 Subject: [PATCH] prim_import: When importing .drvs, allocate the intermediate attrset on the heap just in case it escapes the stack frame. --- src/libexpr/primops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 2ab3eda53..0d4efc47e 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -61,7 +61,7 @@ static void prim_import(EvalState & state, Value * * args, Value & v) if (isStorePath(path) && store->isValidPath(path) && isDerivation(path)) { Derivation drv = parseDerivation(readFile(path)); - Value w; + Value & w = *state.allocValue(); state.mkAttrs(w, 1 + drv.outputs.size()); mkString(*state.allocAttr(w, state.sDrvPath), path, singleton("=" + path)); state.mkList(*state.allocAttr(w, state.symbols.create("outputs")), drv.outputs.size());