Fix leak of arenas_cache in tsd cleanup.
In the function tsd_cleanup(), for nominal tsds, the cleanup function
can wind up creating an arenas_cache. Unfortunately, the tsd_set call
winds up leaking this cache by setting the pointer to NULL. Fix this by
cleaning just the arenas_cache from the newly created tsd.
Bug: 26913856
Change-Id: I84957abdd343bf60106d7d4a92da896f4369a9a9
diff --git a/src/tsd.c b/src/tsd.c
index 9ffe9af..f10aa1a 100644
--- a/src/tsd.c
+++ b/src/tsd.c
@@ -81,6 +81,10 @@
n##_cleanup(tsd);
MALLOC_TSD
#undef O
+ /* ANDROID change */
+ /* Free the arenas_cache if created during cleanup. */
+ arenas_cache_cleanup(tsd_get());
+ /* End ANDROID change */
tsd->state = tsd_state_purgatory;
tsd_set(tsd);
break;