aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvolth <volth@volth.com>2018-07-05 15:33:12 +0000
committervolth <volth@volth.com>2018-07-05 15:33:12 +0000
commite6bf1a79d70686ae48096f2c7227d8a363358ab4 (patch)
treeba0d58b7b81a0f4133d9a05b2fa9e0245af5f8c5 /src
parent841747b0e6d9c391c13159aaeee44599f9508868 (diff)
prim_mapAttrs: must be lazy to avoid infinite recursion
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9b4751970..ed4c0285b 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1365,10 +1365,11 @@ static void prim_mapAttrs(EvalState & state, const Pos & pos, Value * * args, Va
state.mkAttrs(v, args[1]->attrs->size());
for (auto & i : *args[1]->attrs) {
- Value vName, vFun2;
- mkString(vName, i.name);
- state.callFunction(*args[0], vName, vFun2, pos);
- state.callFunction(vFun2, *i.value, *state.allocAttr(v, i.name), pos);
+ Value * vName = state.allocValue();
+ Value * vFun2 = state.allocValue();
+ mkString(*vName, i.name);
+ state.callFunction(*args[0], *vName, *vFun2, pos);
+ mkApp(*state.allocAttr(v, i.name), *vFun2, *i.value);
}
}