diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-01 17:04:38 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-01 17:04:38 +0200 |
commit | ac6ceea7641d6c19c71079e22b03b4c1519c0c94 (patch) | |
tree | 17b1ec42f140f0ad42a8da1e747f2af70cd0bde0 /src | |
parent | 034b6f60626be014d00f68e02d8614ddf7ba44a0 (diff) | |
download | guix-ac6ceea7641d6c19c71079e22b03b4c1519c0c94.tar.gz |
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')
-rw-r--r-- | src/libexpr/nixexpr.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 9f0bc2630d..bca2b7913b 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; |