aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-01 17:04:38 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-01 17:04:38 +0200
commitac6ceea7641d6c19c71079e22b03b4c1519c0c94 (patch)
tree17b1ec42f140f0ad42a8da1e747f2af70cd0bde0 /src/libexpr
parent034b6f60626be014d00f68e02d8614ddf7ba44a0 (diff)
Fix potential segfault
The newEnv variable was accessed (via the dynamicEnv) pointer after it had gone out of scope. Fixes #234.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/nixexpr.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 9f0bc2630..bca2b7913 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -242,9 +242,10 @@ void ExprOpHasAttr::bindVars(const StaticEnv & env)
void ExprAttrs::bindVars(const StaticEnv & env)
{
- const StaticEnv *dynamicEnv = &env;
+ const StaticEnv * dynamicEnv = &env;
+ StaticEnv newEnv(false, &env);
+
if (recursive) {
- StaticEnv newEnv(false, &env);
dynamicEnv = &newEnv;
unsigned int displ = 0;