From 1007072f62e3f3dae03417bbd41f39c9290653ed Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Wed, 19 Oct 2016 21:54:17 +0200 Subject: [PATCH] Fix memory leak (use new memory allocation macro) Fixes https://github.com/sass/libsass/issues/2211 --- src/ast.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ast.cpp b/src/ast.cpp index f1ff1aa460..464a801bbe 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -1054,22 +1054,22 @@ namespace Sass { size_t i = 0, L = h->length(); if (dynamic_cast(h->first())) { if (Class_Selector* sq = dynamic_cast(rh->last())) { - Class_Selector* sqs = new Class_Selector(*sq); + Class_Selector* sqs = SASS_MEMORY_NEW(ctx.mem, Class_Selector, *sq); sqs->name(sqs->name() + (*h)[0]->name()); (*rh)[rh->length()-1] = sqs; for (i = 1; i < L; ++i) *rh << (*h)[i]; } else if (Id_Selector* sq = dynamic_cast(rh->last())) { - Id_Selector* sqs = new Id_Selector(*sq); + Id_Selector* sqs = SASS_MEMORY_NEW(ctx.mem, Id_Selector, *sq); sqs->name(sqs->name() + (*h)[0]->name()); (*rh)[rh->length()-1] = sqs; for (i = 1; i < L; ++i) *rh << (*h)[i]; } else if (Element_Selector* ts = dynamic_cast(rh->last())) { - Element_Selector* tss = new Element_Selector(*ts); + Element_Selector* tss = SASS_MEMORY_NEW(ctx.mem, Element_Selector, *ts); tss->name(tss->name() + (*h)[0]->name()); (*rh)[rh->length()-1] = tss; for (i = 1; i < L; ++i) *rh << (*h)[i]; } else if (Placeholder_Selector* ps = dynamic_cast(rh->last())) { - Placeholder_Selector* pss = new Placeholder_Selector(*ps); + Placeholder_Selector* pss = SASS_MEMORY_NEW(ctx.mem, Placeholder_Selector, *ps); pss->name(pss->name() + (*h)[0]->name()); (*rh)[rh->length()-1] = pss; for (i = 1; i < L; ++i) *rh << (*h)[i];