Fixes a small memory leak in the profiler shutdown code.

This was SVN commit r14854.
This commit is contained in:
Yves 2014-03-17 21:16:38 +00:00
parent cde72788a2
commit 5c4282a21c

View File

@ -195,7 +195,11 @@ void CProfiler2::Shutdown()
m_MgContext = NULL;
}
// TODO: free non-NULL keys, instead of leaking them
// the destructor is not called for the main thread
// we have to call it manually to avoid memory leaks
ENSURE(ThreadUtil::IsMainThread());
void * dataptr = pthread_getspecific(m_TLS);
TLSDtor(dataptr);
int err = pthread_key_delete(m_TLS);
ENSURE(err == 0);