mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-20 15:00:36 -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
|
@ -26,6 +26,7 @@
|
|||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <util/rsmemory.h>
|
||||
#include <serialiser/itempriorities.h>
|
||||
#include <ft/ftturtlefiletransferitem.h>
|
||||
|
||||
|
@ -435,7 +436,7 @@ RsTurtleFileDataItem::RsTurtleFileDataItem(void *data,uint32_t pktsize)
|
|||
if(chunk_size > rssize || rssize - chunk_size < offset)
|
||||
throw std::runtime_error("RsTurtleFileDataItem::() error while deserializing.") ;
|
||||
|
||||
chunk_data = (void*)malloc(chunk_size) ;
|
||||
chunk_data = (void*)rs_safe_malloc(chunk_size) ;
|
||||
|
||||
if(chunk_data == NULL)
|
||||
throw std::runtime_error("RsTurtleFileDataItem::() cannot allocate memory.") ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue