diff options
Diffstat (limited to 'src/Platform/Posix/Tss.c')
| -rw-r--r-- | src/Platform/Posix/Tss.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Platform/Posix/Tss.c b/src/Platform/Posix/Tss.c index dd66429..8a7a2fb 100644 --- a/src/Platform/Posix/Tss.c +++ b/src/Platform/Posix/Tss.c @@ -17,12 +17,19 @@ static void BH_TssKeyCleanup(void *data) { int i; + /* Skip or remove TSS data */ + if (!data) + return; + else if (pthread_setspecific(tssKey, NULL)) + abort(); + /* Lock cleanup table and call cleanups */ BH_SpinlockLock(&tssCleanupLock); for (i = 0; i < tssCleanupSize; i++) tssCleanupData[i](((void **)data)[i]); BH_SpinlockUnlock(&tssCleanupLock); + /* Deallocate TSS data */ free(data); } |
