From 0cf58948ac9bb9c35835e18a00737c362b08f3c7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 26 Nov 2009 14:59:09 +0100 Subject: Avoid using return value from a temporary object The temporary object goes away before the next line is executed, so the pointer to the const data is invalid. Just put it all on one line, and we're ok. Reviewed-by: Brad --- src/corelib/io/qfsfileengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 6aace2c..efc09a0 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -140,8 +140,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) #if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) // FIXME let's see if this stuff works, then we might be able to remove some of the other code - const char *fileName = path.toLocal8Bit().constData(); - char *ret = realpath(fileName, (char*)0); + char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); free(ret); -- cgit v0.12