(empth_exit, empth_rwlock_destroy): Plug memory leaks.

This commit is contained in:
Markus Armbruster 2007-01-28 16:59:15 +00:00
parent d0ab92b944
commit 3db0e2eb15

View file

@ -264,9 +264,12 @@ empth_self(void)
void void
empth_exit(void) empth_exit(void)
{ {
empth_t *ctx = pthread_getspecific(ctx_key);
empth_status("empth_exit"); empth_status("empth_exit");
pthread_mutex_unlock(&mtx_ctxsw); pthread_mutex_unlock(&mtx_ctxsw);
free(pthread_getspecific(ctx_key)); free(ctx->name);
free(ctx);
pthread_exit(0); pthread_exit(0);
} }
@ -479,6 +482,7 @@ void
empth_rwlock_destroy(empth_rwlock_t *rwlock) empth_rwlock_destroy(empth_rwlock_t *rwlock)
{ {
pthread_rwlock_destroy(&rwlock->lock); pthread_rwlock_destroy(&rwlock->lock);
free(rwlock->name);
free(rwlock); free(rwlock);
} }