Fix potential segfault

The newEnv variable was accessed (via the dynamicEnv) pointer after it
had gone out of scope.

Fixes #234.
This commit is contained in:
Eelco Dolstra 2014-04-01 17:04:38 +02:00
parent 034b6f6062
commit ac6ceea764

View file

@ -243,8 +243,9 @@ void ExprOpHasAttr::bindVars(const StaticEnv & env)
void ExprAttrs::bindVars(const StaticEnv & env) void ExprAttrs::bindVars(const StaticEnv & env)
{ {
const StaticEnv * dynamicEnv = &env; const StaticEnv * dynamicEnv = &env;
if (recursive) {
StaticEnv newEnv(false, &env); StaticEnv newEnv(false, &env);
if (recursive) {
dynamicEnv = &newEnv; dynamicEnv = &newEnv;
unsigned int displ = 0; unsigned int displ = 0;