[Freeswitch-svn] [commit] r10837 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su

FreeSWITCH SVN mikej at freeswitch.org
Tue Dec 16 13:29:07 PST 2008


Author: mikej
Date: Tue Dec 16 16:29:07 2008
New Revision: 10837

Log:
SFSIP-107 don't destroy locked mutex

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	Tue Dec 16 16:29:07 2008
@@ -1020,17 +1020,15 @@
     home->suh_blocks = NULL;
 
     if (home->suh_lock) {
-#ifdef WIN32
-      UNLOCK(home); /* we must unlock here or windows leaks handles on the next call because the mutex is locked */
-#endif
-/* "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. "
-   In the Windows pthread implementation we must free the handles that are allocated */
-      _su_home_destroy_mutexes(home->suh_lock);
+		void *suh_lock = home->suh_lock;
+
+		home->suh_lock = NULL;
+
+		/* Unlock, or risk assert() or leak handles on Windows */
+		_su_home_unlocker(suh_lock);
+		_su_home_destroy_mutexes(suh_lock);
     }
   }
-
-  home->suh_lock = NULL;
 }
 
 /** Free memory blocks allocated through home.



More information about the Freeswitch-svn mailing list