aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2012-07-24 12:05:27 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-25 09:30:17 -0400
commitf5954e2d940c3a41a6ed0cad45660e254eb381a3 (patch)
tree3664c3e7ff261dcc413538222c86f1716eccb559
parent1ef2d5765be35c3d3c13a2aea8748166f576ec8b (diff)
prim_import: When importing .drvs, allocate the intermediate attrset on the heap just in case it escapes the stack frame.
-rw-r--r--src/libexpr/primops.cc2
1 files changed, 1 insertions, 1 deletions
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<PathSet>("=" + path));
state.mkList(*state.allocAttr(w, state.symbols.create("outputs")), drv.outputs.size());