Bug 1280578 - Free pAdapterAddrs with GlobalFree in sctp_init_ifns_for_vrf(). r=jesup

Until da6f8ba in upstream git repository, sctp_init_ifns_for_vrf() was
using the MALLOC and FREE macros, using respectively HeapAlloc and
HeapFree. da6f8ba changed the allocations to use GlobalAlloc, but didn't
change the deallocations to use the symmetric GlobalFree.

This doesn't seem to cause direct problems, but when wrapping one family
of allocation functions, the dissymmetry causes allocator mismatch
problems.

Moreover, the MALLOC macro being unused, it might as well be removed,
along the FREE macro, so that both allocations and deallocations use one
API explicitly.

See https://github.com/sctplab/usrsctp/pull/92
This commit is contained in:
Mike Hommey 2016-07-19 17:04:16 +09:00
parent 76db18facb
commit d5a26f74b7

View File

@ -312,14 +312,6 @@ sctp_is_vmware_interface(struct ifnet *ifn)
#endif
#if defined(__Userspace_os_Windows)
#ifdef MALLOC
#undef MALLOC
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#endif
#ifdef FREE
#undef FREE
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
#endif
static void
sctp_init_ifns_for_vrf(int vrfid)
{
@ -381,7 +373,7 @@ sctp_init_ifns_for_vrf(int vrfid)
}
}
if (pAdapterAddrs)
FREE(pAdapterAddrs);
GlobalFree(pAdapterAddrs);
#endif
#ifdef INET6
AdapterAddrsSize = 0;
@ -428,7 +420,7 @@ sctp_init_ifns_for_vrf(int vrfid)
}
}
if (pAdapterAddrs)
FREE(pAdapterAddrs);
GlobalFree(pAdapterAddrs);
#endif
}
#elif defined(__Userspace__)