diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-06-12 09:06:35 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2014-10-30 13:46:42 +0100 |
commit | 1487a93e46bafb4ee7beb63e59b90265f0ae1fd3 (patch) | |
tree | 0fe6ae487b58751d618370531910774474d4649d | |
parent | 848d29cca3afa92f1ae729a1c882e8e3e56fb3e3 (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 <laszlo.agocs@digia.com>
-rw-r--r-- | src/gui/image/qicon.cpp | 2 |
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 |