mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 10:35:22 -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
|
@ -39,6 +39,7 @@
|
|||
#include "util/rsstring.h"
|
||||
#endif
|
||||
#include "util/rsdiscspace.h"
|
||||
#include "util/rsmemory.h"
|
||||
|
||||
#include "ft/ftcontroller.h"
|
||||
|
||||
|
@ -747,11 +748,10 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
size_t T=0;
|
||||
|
||||
static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up.
|
||||
void *buffer = malloc(BUFF_SIZE) ;
|
||||
void *buffer = rs_safe_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 ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue