From d1733d8914a9e098204d2ec5e6573fe953c88b48 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 23 May 2024 12:00:08 +0300 Subject: [PATCH] kdecore: keep reference to the QByteArray object in KStandardDirs::realFilePath() Signed-off-by: Ivailo Monev --- kdecore/kernel/kstandarddirs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kdecore/kernel/kstandarddirs.cpp b/kdecore/kernel/kstandarddirs.cpp index 1023abaa..7d94b818 100644 --- a/kdecore/kernel/kstandarddirs.cpp +++ b/kdecore/kernel/kstandarddirs.cpp @@ -829,7 +829,8 @@ KStandardDirs::realFilePath(const QString &filename) ::memset(realpath_buffer, 0, PATH_MAX + 1); /* If the path contains symlinks, get the real name */ - if (::realpath( QFile::encodeName(filename).constData(), realpath_buffer) != 0) { + const QByteArray filenamebytes = QFile::encodeName(filename); + if (::realpath(filenamebytes.constData(), realpath_buffer) != 0) { // success, use result from realpath return QFile::decodeName(realpath_buffer); }