mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-28 18:42:20 -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
|
@ -98,7 +98,8 @@ void RsGxsImage::take(uint8_t *data, uint32_t size)
|
|||
// NB Must make sure that we always use malloc/free for this data.
|
||||
uint8_t *RsGxsImage::allocate(uint32_t size)
|
||||
{
|
||||
uint8_t *val = (uint8_t *) malloc(size);
|
||||
uint8_t *val = (uint8_t *) rs_safe_malloc(size);
|
||||
|
||||
#ifdef DEBUG_GXSCOMMON
|
||||
std::cerr << "RsGxsImage()::allocate(" << (void *) val << ")";
|
||||
std::cerr << std::endl;
|
||||
|
|
|
@ -26,7 +26,11 @@ bool RsPhotoThumbnail::copyFrom(const RsPhotoThumbnail &nail)
|
|||
|
||||
size = nail.size;
|
||||
type = nail.type;
|
||||
data = (uint8_t *) malloc(size);
|
||||
data = (uint8_t *) rs_safe_malloc(size);
|
||||
|
||||
if(data == NULL)
|
||||
return false ;
|
||||
|
||||
memcpy(data, nail.data, size);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue