Fix potential chunk leaks.
Move chunk_dalloc_arena()'s implementation into chunk_dalloc_wrapper(),
so that if the dalloc hook fails, proper decommit/purge/retain cascading
occurs. This fixes three potential chunk leaks on OOM paths, one during
dss-based chunk allocation, one during chunk header commit (currently
relevant only on Windows), and one during rtree write (e.g. if rtree
node allocation fails).
Merge chunk_purge_arena() into chunk_purge_default() (refactor, no
change to functionality).
Bug: 28590121
(cherry picked from commit 1ae9287a1aec534fa0a805a717f1c4e058ae8433)
Change-Id: Ia21292ab25c65bb7a8aa44077c86545789a9e786
5 files changed