From: lordhavoc Date: Mon, 21 Jan 2002 02:39:08 +0000 (+0000) Subject: changed way windings are allocated, may fix memory corruption bug on MSVC X-Git-Tag: RELEASE_0_2_0_RC1~709 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1e34764e9d45e787ae687859ec2194e99a9ab165;p=xonotic%2Fdarkplaces.git changed way windings are allocated, may fix memory corruption bug on MSVC git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1372 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index dfc3fa02..6788f8a1 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1645,12 +1645,6 @@ typedef struct } winding_t; -typedef struct -{ - int numpoints; -} -windingsizeof_t; - /* ================== NewWinding @@ -1664,7 +1658,7 @@ static winding_t *NewWinding (int points) if (points > MAX_POINTS_ON_WINDING) Host_Error("NewWinding: too many points\n"); - size = sizeof(windingsizeof_t) + sizeof(double[3]) * points; + size = sizeof(winding_t) + sizeof(double[3]) * (points - 8); w = Mem_Alloc(loadmodel->mempool, size); memset (w, 0, size); @@ -2218,6 +2212,7 @@ static void Mod_RecursiveNodePortals (mnode_t *node) nodeportal->plane = *node->plane; nodeportalwinding = BaseWindingForPlane (node->plane); + Mem_CheckSentinels(nodeportalwinding); side = 0; // shut up compiler warning for (portal = (portal_t *)node->portals;portal;portal = portal->next[side]) {