mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 01:10:19 -05:00
avoid potential memory leak for cache files that have been downloaded multiple times. Not sure that this is the cause anyway.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.5@7242 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7c33210b45
commit
5df55a4f1f
@ -890,7 +890,16 @@ bool ftController::completeFile(std::string hash)
|
||||
/* switch map */
|
||||
if (!(fc->mFlags & RS_FILE_REQ_CACHE)) /* clean up completed cache files automatically */
|
||||
{
|
||||
mCompleted[fc->mHash] = fc;
|
||||
std::map<std::string,ftFileControl*>::iterator it = mCompleted.find(fc->mHash) ;
|
||||
|
||||
if(it != mCompleted.end())
|
||||
{
|
||||
delete it->second ;
|
||||
it->second = fc ;
|
||||
}
|
||||
else
|
||||
mCompleted[fc->mHash] = fc;
|
||||
|
||||
completeCount = mCompleted.size();
|
||||
} else
|
||||
delete fc ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user