mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-23 16:21:29 -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
|
@ -2399,6 +2399,13 @@ bdNodeNetMsg::bdNodeNetMsg(char *msg, int len, struct sockaddr_in *in_addr)
|
|||
:data(NULL), mSize(len), addr(*in_addr)
|
||||
{
|
||||
data = (char *) malloc(len);
|
||||
|
||||
if(data == NULL)
|
||||
{
|
||||
std::cerr << "(EE) " << __PRETTY_FUNCTION__ << ": ERROR. cannot allocate memory for " << len << " bytes." << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
memcpy(data, msg, len);
|
||||
//print(std::cerr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue