mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 10:35:22 -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
|
@ -749,6 +749,13 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up.
|
||||
void *buffer = malloc(BUFF_SIZE) ;
|
||||
|
||||
if(buffer == NULL)
|
||||
{
|
||||
std::cerr << "(EE) Error while allocating memory for " << BUFF_SIZE << " bytes in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
fclose (in);
|
||||
fclose (out);
|
||||
return false ;
|
||||
}
|
||||
bool bRet = true;
|
||||
|
||||
while( (s = fread(buffer,1,BUFF_SIZE,in)) > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue