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

@ -290,7 +290,11 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
#ifdef WINDOWS_SYS
// Seems strange to me but M$ documentation suggests to allocate this way...
DWORD bf_size = 16000;
IP_ADAPTER_ADDRESSES* adapter_addresses = (IP_ADAPTER_ADDRESSES*) malloc(bf_size);
IP_ADAPTER_ADDRESSES* adapter_addresses = (IP_ADAPTER_ADDRESSES*) rs_safe_malloc(bf_size);
if(adapter_addresses == NULL)
return false ;
DWORD error = GetAdaptersAddresses(AF_UNSPEC,
GAA_FLAG_SKIP_MULTICAST |
GAA_FLAG_SKIP_DNS_SERVER |