Skip to content

Commit f1df4dc

Browse files
authored
Merge pull request #3088 from mgreter/bugfix/memory-edge-case
Fix an interesting memory handling edge case
2 parents 9515008 + ad289a9 commit f1df4dc

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/cssize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace Sass {
8686

8787
if (parent()->statement_type() == Statement::RULESET)
8888
{
89-
return (r->is_keyframes()) ? SASS_MEMORY_NEW(Bubble, r->pstate(), r) : bubble(r);
89+
return r->is_keyframes() ? SASS_MEMORY_NEW(Bubble, r->pstate(), r) : bubble(r);
9090
}
9191

9292
p_stack.push_back(r);

src/eval.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,10 @@ namespace Sass {
288288
Expression* var = scalars;
289289
env.set_local(variables[0], var);
290290
} else {
291-
// XXX: this is never hit via spec tests
291+
// https://github.com/sass/libsass/issues/3078
292292
for (size_t j = 0, K = variables.size(); j < K; ++j) {
293-
Expression* res = j >= scalars->length()
294-
? SASS_MEMORY_NEW(Null, expr->pstate())
295-
: scalars->at(j);
296-
env.set_local(variables[j], res);
293+
env.set_local(variables[j], j >= scalars->length()
294+
? SASS_MEMORY_NEW(Null, expr->pstate()) : scalars->at(j));
297295
}
298296
}
299297
} else {

src/expand.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,9 @@ namespace Sass {
636636
env.set_local(variables[0], var);
637637
} else {
638638
for (size_t j = 0, K = variables.size(); j < K; ++j) {
639-
ExpressionObj res = j >= scalars->length()
639+
env.set_local(variables[j], j >= scalars->length()
640640
? SASS_MEMORY_NEW(Null, expr->pstate())
641-
: (*scalars)[j]->perform(&eval);
642-
env.set_local(variables[j], res);
641+
: (*scalars)[j]->perform(&eval));
643642
}
644643
}
645644
} else {

0 commit comments

Comments
 (0)