Skip to content

Commit 751cce1

Browse files
committed
Try to fix weird memory leak
1 parent a031677 commit 751cce1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ namespace Sass {
179179
}
180180

181181
if (!result) result = a->value()->accept(this);
182-
182+
if (result) result = withoutSlash(result);
183183

184184
if (auto frame = compiler.getCurrentScope()) {
185185
a->vidx(frame->setModVar(
186186
a->variable(), a->ns(),
187-
withoutSlash(result),
187+
result,
188188
a->is_default(),
189189
a->pstate()));
190190
}

src/eval.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,17 @@ namespace Sass {
645645

646646
// Collect positional args by evaluating input arguments
647647
positional.reserve(arguments->positional().size() + 1);
648-
for (const auto& arg : arguments->positional()) {
649-
positional.emplace_back(withoutSlash(arg->accept(this)));
648+
for (const auto& arg : arguments->positional())
649+
{
650+
ValueObj result(arg->accept(this));
651+
positional.emplace_back(withoutSlash(result));
650652
}
651653

652654
// Collect named args by evaluating input arguments
653655
for (const auto& kv : arguments->named()) {
656+
ValueObj result(kv.second->accept(this));
654657
named.insert(std::make_pair(kv.first,
655-
withoutSlash(kv.second->accept(this))));
658+
withoutSlash(result)));
656659
}
657660

658661
// Abort if we don't take any restargs
@@ -663,7 +666,8 @@ namespace Sass {
663666
}
664667

665668
// Evaluate the variable expression (
666-
ValueObj rest = withoutSlash(arguments->restArg()->accept(this));
669+
ValueObj result = arguments->restArg()->accept(this);
670+
ValueObj rest = withoutSlash(result);
667671

668672
SassSeparator separator = SASS_UNDEF;
669673

0 commit comments

Comments
 (0)