summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2014-01-14 14:21:10 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-27 17:54:05 +0000
commiteba9769b7e794cf1df204d8365a84e7f70c5a510 (patch)
treebee6cf1105a6d9e29243db7af0c96f924e6d2f17 /qmake
parent771724d2f47aefb24b1627a7e60cf3a90bcbe772 (diff)
QmakeParser: Do not leak temporaries into cache of files
This prevents an access to free'd memory when opening qtcreator.pro. Looks like qml2puppet.pro gets added to that cache in QMakeVfs::writeFile with part of the including pro-file's filename in it. That part gets cleaned when that containing ProFile goes out of scope, leaving a key in QMakeVfs::m_files free'd but accessible. Change-Id: I80b43d2fbb66c214647497ea97e6e3a587e274d6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> (cherry picked from qtcreator/336c3159617cdb3edd35021b5fb312d4d43f9a84) Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/library/qmakebuiltins.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 51ba6dc0a0..4398937015 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -1556,7 +1556,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (!args.at(2).toQString(m_tmp1).compare(fL1S("append"), Qt::CaseInsensitive))
mode = QIODevice::Append;
}
- return writeFile(QString(), resolvePath(args.at(0).toQString(m_tmp1)), mode, contents);
+ QString path = resolvePath(args.at(0).toQString(m_tmp1));
+ path.detach(); // make sure to not leak m_tmp1 into the map of written files.
+ return writeFile(QString(), path, mode, contents);
}
case T_TOUCH: {
if (args.count() != 2) {