From 1e34764e9d45e787ae687859ec2194e99a9ab165 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Mon, 21 Jan 2002 02:39:08 +0000 Subject: [PATCH] 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 --- model_brush.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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]) { -- 2.39.2