Release resources when repeating dlopen-dlcose.
When the libbinder.so is dlopen and dlclose many
times, we need to delete the pthread_key and
munmap the memory mapping.
Otherwise, it will crash as the leakage causes
the pthread_key or memory mapping surpass their
limit.
Change-Id: Ice64d4ef685c1f665350286f9e5ddf790beac236
Signed-off-by: zhongjie <[email protected]>
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp
index 1f6bda2..6d4071e 100644
--- a/IPCThreadState.cpp
+++ b/IPCThreadState.cpp
@@ -328,6 +328,7 @@
delete st;
pthread_setspecific(gTLS, NULL);
}
+ pthread_key_delete(gTLS);
gHaveTLS = false;
}
}