Skip to content

Commit

Permalink
Fix memory issues reported by clang memory sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Oct 22, 2016
1 parent eb0343e commit 51ff53f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,12 @@ namespace Sass {

if (s->statement_type() == Statement::DIRECTIVE)
{
return expression()->exclude(static_cast<Directive*>(s)->keyword().erase(0, 1));
if (Directive* dir = dynamic_cast<Directive*>(s))
{
std::string keyword(dir->keyword());
if (keyword.length() > 0) keyword.erase(0, 1);
return expression()->exclude(keyword);
}
}
if (s->statement_type() == Statement::MEDIA)
{
Expand All @@ -1752,9 +1757,9 @@ namespace Sass {
{
return expression()->exclude("supports");
}
if (static_cast<Directive*>(s)->is_keyframes())
if (Directive* dir = dynamic_cast<Directive*>(s))
{
return expression()->exclude("keyframes");
if (dir->is_keyframes()) return expression()->exclude("keyframes");
}
return false;
}
Expand Down

0 comments on commit 51ff53f

Please sign in to comment.