Skip to content

Commit 73395b3

Browse files
committed
Fix memory leak when Ruleset expansion throws exception
1 parent d12955e commit 73395b3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/expand.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,9 @@ namespace Sass {
141141
}
142142

143143
selector_stack.push_back(sel);
144-
Env* env = 0;
144+
Env env(environment());
145145
if (block_stack.back()->is_root()) {
146-
env = new Env(environment());
147-
env_stack.push_back(env);
146+
env_stack.push_back(&env);
148147
}
149148
sel->set_media_block(media_block_stack.back());
150149
Block* blk = r->block()->perform(this)->block();
@@ -155,8 +154,8 @@ namespace Sass {
155154
selector_stack.pop_back();
156155
if (block_stack.back()->is_root()) {
157156
env_stack.pop_back();
158-
delete env;
159157
}
158+
160159
rr->is_root(r->is_root());
161160
rr->tabs(r->tabs());
162161

0 commit comments

Comments
 (0)