From 7780b6ef767813b4c0a45c31921550c6a95806c9 Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@jerris.com> Date: Tue, 14 Oct 2008 16:08:43 +0000 Subject: [PATCH] (SFSIP-88) handle leak on windows git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10006 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c index b75f4f931d..f42514728d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c @@ -1019,8 +1019,15 @@ void _su_home_deinit(su_home_t *home) home->suh_blocks = NULL; - if (home->suh_lock) + 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); + } } home->suh_lock = NULL;