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:
csoler 2016-01-12 21:10:11 -05:00
parent 9c6e7dfc13
commit d13526facd
39 changed files with 274 additions and 132 deletions

View file

@ -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) ;
}