summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2010-08-26 11:20:45 (GMT)
committermread <qt-info@nokia.com>2010-08-26 11:20:45 (GMT)
commit4fdb6a01b35d9cd4dc9e5e4d6682449476d68375 (patch)
treeb1dd3c44f122880692f37194dbc6f5fbbddcf98e
parent4c9212cdf38b35e89311416436f1e60b818b69c3 (diff)
downloadQt-4fdb6a01b35d9cd4dc9e5e4d6682449476d68375.zip
Qt-4fdb6a01b35d9cd4dc9e5e4d6682449476d68375.tar.gz
Qt-4fdb6a01b35d9cd4dc9e5e4d6682449476d68375.tar.bz2
fix for memory leak in QSysInfo::s60Version()
A CDir was not deleted on several return paths in QSysInfo::s60Version(). This fix uses a QScopedPointer to clean up the CDir no matter what return path is taken. Reviewed-by: Simon Hausmann
-rw-r--r--src/corelib/global/qglobal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index af35316..401af85 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1828,6 +1828,7 @@ QSysInfo::S60Version QSysInfo::s60Version()
CDir* contents;
TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
if (err == KErrNone) {
+ QScopedPointer<CDir> contentsDeleter(contents);
err = contents->Sort(EDescending|ESortByName);
if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
TInt major = (*contents)[0].iName[9] - '0';
@@ -1850,7 +1851,6 @@ QSysInfo::S60Version QSysInfo::s60Version()
}
}
}
- delete contents;
}
# ifdef Q_CC_NOKIAX86