mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -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
|
@ -29,6 +29,7 @@
|
|||
#include "rsserver/p3face.h"
|
||||
#include "dbase/fimonitor.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsmemory.h"
|
||||
#include "pqi/authssl.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
|
@ -128,13 +129,11 @@ HashCache::HashCache(const std::string& path)
|
|||
|
||||
// read the binary stream into memory.
|
||||
//
|
||||
void *buffer = malloc(file_size) ;
|
||||
void *buffer = rs_safe_malloc(file_size) ;
|
||||
|
||||
if(buffer == NULL)
|
||||
{
|
||||
std::cerr << "Cannot allocate memory for reading encrypted file cache, bytes=" << file_size << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
FILE *F = fopen( (_path+".bin").c_str(),"rb") ;
|
||||
if (!F)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue