diff --git a/Quake/host.c b/Quake/host.c index a39df6b1..ab8fd73f 100644 --- a/Quake/host.c +++ b/Quake/host.c @@ -549,6 +549,7 @@ void Host_ClearMemory (void) /* host_hunklevel MUST be set at this point */ Hunk_FreeToLowMark (host_hunklevel); cls.signon = 0; + if (sv.edicts) free(sv.edicts); // ericw -- sv.edicts switched to use malloc() memset (&sv, 0, sizeof(sv)); memset (&cl, 0, sizeof(cl)); } diff --git a/Quake/pr_edict.c b/Quake/pr_edict.c index 90f2c498..9932e081 100644 --- a/Quake/pr_edict.c +++ b/Quake/pr_edict.c @@ -129,7 +129,7 @@ edict_t *ED_Alloc (void) sv.num_edicts++; e = EDICT_NUM(i); - ED_ClearEdict (e); + memset(e, 0, pr_edict_size); // ericw -- switched sv.edicts to malloc(), so we are accessing uninitialized memory and must fully zero it, not just ED_ClearEdict return e; } diff --git a/Quake/sv_main.c b/Quake/sv_main.c index b5d11aca..60699bf3 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -1332,7 +1332,7 @@ void SV_SpawnServer (const char *server) // allocate server memory /* Host_ClearMemory() called above already cleared the whole sv structure */ sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar - sv.edicts = (edict_t *) Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts"); + sv.edicts = (edict_t *) malloc (sv.max_edicts*pr_edict_size); // ericw -- sv.edicts switched to use malloc() sv.datagram.maxsize = sizeof(sv.datagram_buf); sv.datagram.cursize = 0; @@ -1348,6 +1348,7 @@ void SV_SpawnServer (const char *server) // leave slots at start for clients only sv.num_edicts = svs.maxclients+1; + memset(sv.edicts, 0, sv.num_edicts*pr_edict_size); // ericw -- sv.edicts switched to use malloc() for (i=0 ; i