When removing entries from hash table, delete only the contents of the cached data (pointed to by m_data), not the entire MemFSHashObj

This commit is contained in:
Charlie Fenton 2012-12-21 06:23:02 -08:00 committed by Oliver Bock
parent ac2930af0b
commit 2ceec2926e
1 changed files with 3 additions and 2 deletions

View File

@ -631,7 +631,6 @@ void CBOINCInternetFSHandler::UnchacheMissingItems() {
// We must get next node before deleting this one // We must get next node before deleting this one
node = m_Hash->Next(); node = m_Hash->Next();
if (obj->m_Len == 0) { if (obj->m_Len == 0) {
delete obj;
m_Hash->Delete(obj->m_Key); m_Hash->Delete(obj->m_Key);
} }
} }
@ -647,7 +646,9 @@ void CBOINCInternetFSHandler::ClearCache() {
MemFSHashObj* obj = (MemFSHashObj*)node->GetData(); MemFSHashObj* obj = (MemFSHashObj*)node->GetData();
// We must get next node before deleting this one // We must get next node before deleting this one
node = m_Hash->Next(); node = m_Hash->Next();
delete obj; if (obj->m_Data) {
delete[] obj->m_Data;
}
m_Hash->Delete(obj->m_Key); m_Hash->Delete(obj->m_Key);
} }
m_bMissingItems = false; m_bMissingItems = false;