path: root/src/gui/image
diff options
authorLars Knoll <>2014-06-12 09:06:35 +0200
committerLars Knoll <>2014-10-30 13:46:42 +0100
commit1487a93e46bafb4ee7beb63e59b90265f0ae1fd3 (patch)
tree0fe6ae487b58751d618370531910774474d4649d /src/gui/image
parent848d29cca3afa92f1ae729a1c882e8e3e56fb3e3 (diff)
Fix a possible use after free
Found by coverity. The cachedIcon can be deleted when being inserted into the icon cache (in QCache::insert). So copy it to icon before trying to insert it into the cache. Change-Id: I5ed13c0c7ecb8f8f13285ca5d06237493dbea479 Reviewed-by: Laszlo Agocs <>
Diffstat (limited to 'src/gui/image')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index adbd21a8a0..6f6bf158c8 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1173,8 +1173,8 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
QIconEngine * const engine = platformTheme ? platformTheme->createIconEngine(name)
: new QIconLoaderEngine(name);
QIcon *cachedIcon = new QIcon(engine);
- qtIconCache()->insert(name, cachedIcon);
icon = *cachedIcon;
+ qtIconCache()->insert(name, cachedIcon);
// Note the qapp check is to allow lazy loading of static icons