Skip to content

Commit ef8b33e

Browse files
committed
Fix potential memory leaks
1 parent aa213da commit ef8b33e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/eval.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,9 @@ namespace Sass {
11141114

11151115
ValueObj rv = condition ? condition->accept(this) : nullptr;
11161116
Expression* ex = rv && rv->isTruthy() ? ifTrue : ifFalse;
1117-
return ex ? withoutSlash(ex->accept(this)) : nullptr;
1117+
if (ex == nullptr) return nullptr;
1118+
ValueObj result(ex->accept(this));
1119+
return withoutSlash(result);
11181120
}
11191121

11201122
Value* Eval::visitParenthesizedExpression(ParenthesizedExpression* ex)
@@ -2324,8 +2326,8 @@ namespace Sass {
23242326

23252327
Value* Eval::visitReturnRule(ReturnRule* rule)
23262328
{
2327-
return withoutSlash(
2328-
rule->value()->accept(this));
2329+
ValueObj result(rule->value()->accept(this));
2330+
return withoutSlash(result);
23292331
}
23302332

23312333
Value* Eval::visitSilentComment(SilentComment* c)

0 commit comments

Comments
 (0)