fixed use-after-free in sksl switch statements
Bug: skia:
Change-Id: I66ef1cd2af9c654bfa40a71b2218cfde49f3a54e
Reviewed-on: https://skia-review.googlesource.com/24329
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 3a037e7..0584ff1 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -846,7 +846,7 @@
for (const auto& s : statementPtrs) {
statements.push_back(std::move(*s));
}
- return std::unique_ptr<Statement>(new Block(Position(), std::move(statements)));
+ return std::unique_ptr<Statement>(new Block(Position(), std::move(statements), s->fSymbols));
}
void Compiler::simplifyStatement(DefinitionMap& definitions,