path: root/tools
diff options
authorSimon Hausmann <>2019-03-22 09:43:16 +0100
committerSimon Hausmann <>2019-03-22 12:42:32 +0000
commit90a08b0c52fbe20ea3324f7315c04c48c95a8e61 (patch)
treea1653bd740e62053d8deb76db5a54337c612b35c /tools
parent93ed9213f74dcd3806b0b2bfabc9900a545a5c69 (diff)
Fix memory "leaks" in qmlcachegen
The CompilationUnit class owns the unit data. An exception was made in bootstrap builds, where it was up to the caller to free the memory. This lead to cases in qmlcachegen where we didn't free the memory. This is best fixed by unifying the behavior. This fixes the build when using an ASAN enabled build, as the runtime aborts after calling qmlcachegen due to "leaks". Change-Id: I8b55b4e302a9569a1d4e09eeb488c479368b50f0 Reviewed-by: Lars Knoll <>
Diffstat (limited to 'tools')
1 files changed, 0 insertions, 4 deletions
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp
index e8583996bf..2b84a6babe 100644
--- a/tools/qmlcachegen/qmlcachegen.cpp
+++ b/tools/qmlcachegen/qmlcachegen.cpp
@@ -232,8 +232,6 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti
if (!saveFunction(irDocument.javaScriptCompilationUnit, &error->message))
return false;
- free(unit);
return true;
@@ -241,7 +239,6 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti
static bool compileJSFile(const QString &inputFileName, const QString &inputFileUrl, SaveFunction saveFunction, Error *error)
QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit;
- QScopedPointer<QV4::CompiledData::Unit, QScopedPointerPodDeleter> unitDataToFree;
QString sourceCode;
@@ -323,7 +320,6 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile
QV4::CompiledData::Unit *unitData = const_cast<QV4::CompiledData::Unit*>(irDocument.javaScriptCompilationUnit->data);
unitData->flags |= QV4::CompiledData::Unit::StaticData;
- unitDataToFree.reset(unitData);
unit = irDocument.javaScriptCompilationUnit;