mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 02:25:34 -04:00
added checks after mallocs in several files
This commit is contained in:
parent
46520b0e22
commit
9c6e7dfc13
15 changed files with 157 additions and 12 deletions
|
@ -349,6 +349,13 @@ RsGRouterGenericDataItem *RsGRouterGenericDataItem::duplicate() const
|
|||
// then duplicate the memory chunk
|
||||
|
||||
item->data_bytes = (uint8_t*)malloc(data_size) ;
|
||||
|
||||
if(item->data_bytes == NULL)
|
||||
{
|
||||
std::cerr << "(EE) memory allocation error for " << data_size << " bytes in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
memcpy(item->data_bytes,data_bytes,data_size) ;
|
||||
|
||||
return item ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue