From kde-commits Fri Jan 28 21:42:06 2005 From: =?utf-8?q?Andr=C3=A9=20W=C3=B6bbeking?= Date: Fri, 28 Jan 2005 21:42:06 +0000 To: kde-commits Subject: kdebase/libkonq Message-Id: <20050128214206.03B041CF5F () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110694855416127 CVS commit by woebbe: --leaks in addToHistory(), patch by dfaure M +8 -5 konq_historymgr.cc 1.52 --- kdebase/libkonq/konq_historymgr.cc #1.51:1.52 @@ -299,7 +299,7 @@ void KonqHistoryManager::addToHistory( b entry.lastVisited = entry.firstVisited; - if ( !pending ) { // remove from pending if available. + // always remove from pending if available, otherwise the else branch leaks + // if the map already contains an entry for this key. QMapIterator it = m_pending.find( u ); - if ( it != m_pending.end() ) { delete it.data(); @@ -305,5 +305,8 @@ void KonqHistoryManager::addToHistory( b delete it.data(); m_pending.remove( it ); + } + if ( !pending ) { + if ( it != m_pending.end() ) { // we make a pending entry official, so we just have to update // and not increment the counter. No need to care about