mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-07 22:02:32 -04:00
added a new method rs_malloc that checks its arguments and prints a stacktrace on error/weird call. Changed the code everywhere to use this instead of malloc. Removed some mallocs and replaced with RsTemporaryMemory
This commit is contained in:
parent
9c6e7dfc13
commit
d13526facd
39 changed files with 274 additions and 132 deletions
|
@ -280,11 +280,10 @@ int p3VOIP::sendVoipData(const RsPeerId& peer_id,const RsVOIPDataChunk& chunk)
|
|||
std::cerr << "Cannot allocate RsVOIPDataItem !" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
item->voip_data = malloc(chunk.size) ;
|
||||
item->voip_data = rs_safe_malloc(chunk.size) ;
|
||||
|
||||
if(item->voip_data == NULL)
|
||||
{
|
||||
std::cerr << "Cannot allocate RsVOIPDataItem.voip_data of size " << chunk.size << " !" << std::endl;
|
||||
delete item ;
|
||||
return false ;
|
||||
}
|
||||
|
@ -432,11 +431,10 @@ bool p3VOIP::getIncomingData(const RsPeerId& peer_id,std::vector<RsVOIPDataChunk
|
|||
{
|
||||
RsVOIPDataChunk chunk ;
|
||||
chunk.size = (*it2)->data_size ;
|
||||
chunk.data = malloc((*it2)->data_size) ;
|
||||
chunk.data = rs_safe_malloc((*it2)->data_size) ;
|
||||
|
||||
if(chunk.data == NULL)
|
||||
{
|
||||
std::cerr << "(EE) p3VOIP::getIncomingData(): error. Cannot allocate memory for chunk of size " << chunk.size << std::endl;
|
||||
delete *it2 ;
|
||||
continue ;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue