Scudo is expected to call scudo_allocate_hook on allocations, and
scudo_deallocate_hook on deallocations, but it's behavior is not
clear on reallocations. Currently, non-trivial reallocations call
scudo_allocate_hook but never scudo_deallocate_hook. We should
prefer either calling both, none, or a dedicated
hook (__scudo_reallocate_hook, for instance).
This patch implements the former, and adds a unit test to enforce
those expectations.
I'm thinking that we can move this to quarantineOrDeallocateChunk() then we have single location for both allocation and deallocation. Then for the tests, we only need to ensure that calling allocate/deallocate have the callback invoked, i.e., we don't need to depend on the implementation (like the size-class in the test case)
The only case we may miss is when nullptr deallocation but I think that may be fine.
@cryptoad, what do you think?