summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Doerffel <tobias.doerffel@gmail.com>2010-10-28 12:43:20 +0200
committerChristian Beier <dontmind@freeshell.org>2010-10-29 14:04:14 +0200
commit5da7c7a71ac1db69902c3a2a80f8771713dde70f (patch)
tree594d2f09be54649460051833e224df688d757b2b
parent128d06aaaa40f990e80d67bde851b7c6b2369615 (diff)
downloadlibtdevnc-5da7c7a7.tar.gz
libtdevnc-5da7c7a7.zip
Added missing initialization of extension mutex
When not calling rfbRegisterProtocolExtension() the extension mutex is uninitialized but used upon calling rfbGetExtensionIterator() and rfbReleaseExtensionIterator() in rfbNewTCPOrUDPClient(). This causes libvncserver to crash on Win32 when building with thread support. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com> Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r--libvncserver/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 807d782..28bbc42 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -145,6 +145,11 @@ rfbUnregisterProtocolExtension(rfbProtocolExtension* extension)
rfbProtocolExtension* rfbGetExtensionIterator()
{
+ if (! extMutex_initialized) {
+ INIT_MUTEX(extMutex);
+ extMutex_initialized = 1;
+ }
+
LOCK(extMutex);
return rfbExtensionHead;
}