Skip to content

Commit

Permalink
Merge pull request #3088 from mgreter/bugfix/memory-edge-case
Browse files Browse the repository at this point in the history
Fix an interesting memory handling edge case
  • Loading branch information
mgreter authored May 1, 2020
2 parents 9515008 + ad289a9 commit f1df4dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cssize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace Sass {

if (parent()->statement_type() == Statement::RULESET)
{
return (r->is_keyframes()) ? SASS_MEMORY_NEW(Bubble, r->pstate(), r) : bubble(r);
return r->is_keyframes() ? SASS_MEMORY_NEW(Bubble, r->pstate(), r) : bubble(r);
}

p_stack.push_back(r);
Expand Down
8 changes: 3 additions & 5 deletions src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,10 @@ namespace Sass {
Expression* var = scalars;
env.set_local(variables[0], var);
} else {
// XXX: this is never hit via spec tests
// https://github.com/sass/libsass/issues/3078
for (size_t j = 0, K = variables.size(); j < K; ++j) {
Expression* res = j >= scalars->length()
? SASS_MEMORY_NEW(Null, expr->pstate())
: scalars->at(j);
env.set_local(variables[j], res);
env.set_local(variables[j], j >= scalars->length()
? SASS_MEMORY_NEW(Null, expr->pstate()) : scalars->at(j));
}
}
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,9 @@ namespace Sass {
env.set_local(variables[0], var);
} else {
for (size_t j = 0, K = variables.size(); j < K; ++j) {
ExpressionObj res = j >= scalars->length()
env.set_local(variables[j], j >= scalars->length()
? SASS_MEMORY_NEW(Null, expr->pstate())
: (*scalars)[j]->perform(&eval);
env.set_local(variables[j], res);
: (*scalars)[j]->perform(&eval));
}
}
} else {
Expand Down

0 comments on commit f1df4dc

Please sign in to comment.