mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 17:04:58 -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
|
@ -30,6 +30,7 @@
|
|||
#include <assert.h>
|
||||
#include "rscompress.h"
|
||||
#include "zlib.h"
|
||||
#include "util/rsmemory.h"
|
||||
|
||||
// 16K buffer size.
|
||||
//
|
||||
|
@ -42,7 +43,10 @@ bool RsCompress::compress_memory_chunk(const uint8_t *input_mem,const uint32_t i
|
|||
uint32_t output_offset = 0 ;
|
||||
uint32_t input_offset = 0 ;
|
||||
output_size = 1024 ;
|
||||
output_mem = (uint8_t*)malloc(output_size) ;
|
||||
output_mem = (uint8_t*)rs_safe_malloc(output_size) ;
|
||||
|
||||
if(!output_mem)
|
||||
return false ;
|
||||
|
||||
int ret, flush;
|
||||
unsigned have;
|
||||
|
@ -113,8 +117,11 @@ bool RsCompress::uncompress_memory_chunk(const uint8_t *input_mem,const uint32_t
|
|||
output_size = input_size ;
|
||||
uint32_t output_offset = 0 ;
|
||||
uint32_t input_offset = 0 ;
|
||||
output_mem = (uint8_t*)malloc(output_size) ;
|
||||
output_mem = (uint8_t*)rs_safe_malloc(output_size) ;
|
||||
|
||||
if(!output_mem)
|
||||
return false ;
|
||||
|
||||
int ret;
|
||||
unsigned have;
|
||||
z_stream strm;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue