mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 06:31: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
|
@ -151,11 +151,25 @@ class SignatureEventData
|
|||
{
|
||||
// We need a new memory chnk because there's no guarranty _sign nor _signlen are not in the stack
|
||||
|
||||
sign = (unsigned char *)malloc(_signlen) ;
|
||||
sign = (unsigned char *)rs_safe_malloc(_signlen) ;
|
||||
|
||||
if(!sign)
|
||||
{
|
||||
signlen = NULL ;
|
||||
signature_result = SELF_SIGNATURE_RESULT_FAILED ;
|
||||
return ;
|
||||
}
|
||||
|
||||
signlen = new unsigned int ;
|
||||
*signlen = _signlen ;
|
||||
signature_result = SELF_SIGNATURE_RESULT_PENDING ;
|
||||
data = malloc(_len) ;
|
||||
data = rs_safe_malloc(_len) ;
|
||||
|
||||
if(!data)
|
||||
{
|
||||
len = 0 ;
|
||||
return ;
|
||||
}
|
||||
len = _len ;
|
||||
memcpy(data,_data,len) ;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue