SFSIP-107 don't destroy locked mutex

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10837 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-12-16 21:29:07 +00:00
parent 1236f4a454
commit 868856a81c
1 changed files with 7 additions and 9 deletions

View File

@ -1020,17 +1020,15 @@ void _su_home_deinit(su_home_t *home)
home->suh_blocks = NULL; home->suh_blocks = NULL;
if (home->suh_lock) { if (home->suh_lock) {
#ifdef WIN32 void *suh_lock = home->suh_lock;
UNLOCK(home); /* we must unlock here or windows leaks handles on the next call because the mutex is locked */
#endif home->suh_lock = NULL;
/* "In the LinuxThreads implementation, no resources are associated with mutex objects,
thus pthread_mutex_destroy actually does nothing except checking that the mutex is unlocked. " /* Unlock, or risk assert() or leak handles on Windows */
In the Windows pthread implementation we must free the handles that are allocated */ _su_home_unlocker(suh_lock);
_su_home_destroy_mutexes(home->suh_lock); _su_home_destroy_mutexes(suh_lock);
} }
} }
home->suh_lock = NULL;
} }
/** Free memory blocks allocated through home. /** Free memory blocks allocated through home.