aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-06-15 09:03:53 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-06-25 20:04:05 +0000
commitd5adc61b1fe358f7ba5d3570305eaf0733426e2f (patch)
tree5f5d041a57d2c7d800acefc0ca9e5cb9b80b37d2 /src/qml/compiler/qv4compilerscanfunctions.cpp
parentd26a497f3eaf37d6733b4ab1bceb2158eb127648 (diff)
Fix string memory leak in JavaScript AST
Commit 02252ae08d introduced a QString member in a JS memory pool class, which leaks unfortunately as the pool is not designed to call destructors of allocated types. Typically strings in the AST are derived from input and therefore a QStringRef is fine. The bindingIdentifier in the PatterElement however is sometimes synthesized, so a separate storage for dynamically allocated strings in the memory pool allows for using QStringRef again. Change-Id: I94d090df653d784c554452722b3b759031e4735b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index 7506b238f8..f3c1694b79 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -360,7 +360,7 @@ bool ScanFunctions::visit(Catch *ast)
TemporaryBoolAssignment allowFuncDecls(_allowFuncDecls, _context->isStrict ? false : _allowFuncDecls);
enterEnvironment(ast, ContextType::Block, QStringLiteral("%CatchBlock"));
_context->isCatchBlock = true;
- QString caughtVar = ast->patternElement->bindingIdentifier;
+ QString caughtVar = ast->patternElement->bindingIdentifier.toString();
if (caughtVar.isEmpty())
caughtVar = QStringLiteral("@caught");
_context->addLocalVar(caughtVar, Context::MemberType::VariableDefinition, VariableScope::Let);