diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
index 9cbc3793dfaf8565c758f463b3e2c93cd25b2719..4a73a035830b4bcb96e9b8e2b16edffb8bd70be8 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
@@ -104,8 +104,11 @@ void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos)
                 break;
             }
         }
-        if (skip)
+        if (skip) {
+            if (i.isTemporary)
+                delete i.version;
             continue;
+        }
 
         m_infos.append(i);
 
@@ -382,6 +385,7 @@ void TargetSetupPage::importDirectoryAdded(const QString &directory)
         return;
     m_directoryChooser->setPath(QString());
     QList<ImportInfo> tmp = m_infos;
+    m_infos.clear(); // Clear m_infos without deleting temporary QtVersions!
     tmp.append(recursivelyCheckDirectoryForBuild(directory));
     setImportInfos(tmp);
 }