Fix a curl-related hang when exiting.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Mar 2015 11:24:27 +0000 (11:24 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Mar 2015 11:24:27 +0000 (11:24 +0000)
Fix a NULL crash when creating a sound without a worldmodel (harmless
NULL, but exploitable by svc_disconnect svc_sound in a single packet).

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12204 d7cf8633-e32d-0410-b094-e92efae38249

libcurl.c
snd_main.c

index b228350..2f001d5 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -980,6 +980,7 @@ static qboolean Curl_Begin(const char *URL, const char *extraheaders, double max
                                                ++numdownloads_added;
                                        }
 
+                                       if (curl_mutex) Thread_UnlockMutex(curl_mutex);
                                        return false;
                                }
                        }
@@ -1003,6 +1004,7 @@ static qboolean Curl_Begin(const char *URL, const char *extraheaders, double max
                                                        }
                                                }
 
+                                               if (curl_mutex) Thread_UnlockMutex(curl_mutex);
                                                return false;
                                        }
                                        else
index 251084a..d54267b 100644 (file)
@@ -1493,7 +1493,7 @@ static void SND_Spatialize_WithSfx(channel_t *ch, qboolean isstatic, sfx_t *sfx)
                        if (snd_spatialization_occlusion.integer)
                        {
                                if(snd_spatialization_occlusion.integer & 1)
-                                       if(listener_pvs)
+                                       if(listener_pvs && cl.worldmodel)
                                        {
                                                int cluster = cl.worldmodel->brush.PointInLeaf(cl.worldmodel, ch->origin)->clusterindex;
                                                if(cluster >= 0 && cluster < 8 * listener_pvsbytes && !CHECKPVSBIT(listener_pvs, cluster))