Set current thread state to NULL in teardown
In the EGL destructor, DestroyThreadState gets called by __eglCurrentTeardown to free the threadState, but the threadState does not get changed to NULL when this happens. The function eglReleaseThread calls __eglDestroyCurrentThreadAPIState, which does set the threadState to NULL, right before calling DestroyThreadState. Both eglReleaseThread and __eglDestroyCurrentThreadAPIState check to make sure the threadState is NULL before continuing. If eglReleaseThread gets externally called after destruction, the threadState is not NULL, so DestroyThreadState will be called to free the threadState that was already freed by the destructor, causing a double free. This change is to add the same setting threadState to NULL in __eglCurrentTeardown as which already __eglDestroyCurrentThreadAPIState, to prevent this double free situation.
This commit is contained in:
parent
c8ee0055df
commit
4834bd26e7
|
@ -94,7 +94,8 @@ void __eglCurrentTeardown(EGLBoolean doReset)
|
|||
while (!glvnd_list_is_empty(¤tThreadStateList)) {
|
||||
__EGLThreadAPIState *threadState = glvnd_list_first_entry(
|
||||
¤tThreadStateList, __EGLThreadAPIState, entry);
|
||||
DestroyThreadState(threadState);
|
||||
__glvndPthreadFuncs.setspecific(threadStateKey, NULL);
|
||||
DestroyThreadState(threadState);
|
||||
}
|
||||
|
||||
if (doReset) {
|
||||
|
|
Loading…
Reference in a new issue