mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 22:40:36 -04:00
fixed some leaking memory issues in loadList() methods, and also increased consistency by not returning non empty list with deleted items inside
This commit is contained in:
parent
48750cdb51
commit
8a41554754
22 changed files with 208 additions and 164 deletions
|
@ -279,6 +279,11 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
|||
/* error */
|
||||
std::cerr << "p3BitDht::loadList() Error only expecting 1 item";
|
||||
std::cerr << std::endl;
|
||||
|
||||
for(std::list<RsItem*>::iterator it=load.begin();it!=load.end();++it)
|
||||
delete *it ;
|
||||
|
||||
load.clear() ;
|
||||
return false;
|
||||
}
|
||||
RsItem *item = load.front();
|
||||
|
@ -290,6 +295,7 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
|||
/* error */
|
||||
std::cerr << "p3BitDht::loadList() Error expecting item = config";
|
||||
std::cerr << std::endl;
|
||||
delete item ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -393,6 +399,7 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
|
|||
setRelayMode(mode);
|
||||
}
|
||||
|
||||
load.clear() ;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue