Skip to content

Commit 22d5142

Browse files
committed
Merge pull request #1884 from mgreter/bugfix/memory-issue
Ensure we keep around memory for parser source
2 parents f1155e4 + 47797f8 commit 22d5142

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/expand.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ namespace Sass {
185185
Statement* Expand::operator()(Media_Block* m)
186186
{
187187
Expression* mq = m->media_queries()->perform(&eval);
188-
mq = Parser::from_c_str(mq->to_string(ctx.c_options).c_str(), ctx, mq->pstate()).parse_media_queries();
188+
std::string str_mq(mq->to_string(ctx.c_options));
189+
char* str = sass_strdup(str_mq.c_str());
190+
ctx.strings.push_back(str);
191+
Parser p(Parser::from_c_str(str, ctx, mq->pstate()));
192+
mq = p.parse_media_queries();
189193
Media_Block* mm = SASS_MEMORY_NEW(ctx.mem, Media_Block,
190194
m->pstate(),
191195
static_cast<List*>(mq->perform(&eval)),

0 commit comments

Comments
 (0)