Skip to content

Commit e76263d

Browse files
authored
[MP] Fix memory leak when loading sub BSPs (#1294)
1 parent d1cb662 commit e76263d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

codemp/qcommon/cm_load.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,12 @@ static void CM_LoadMap_Actual( const char *name, qboolean clientload, int *check
757757
// for the renderer to chew on... (but not if this gets ported to a big-endian machine, because some of the
758758
// map data will have been Little-Long'd, but some hasn't).
759759
//
760-
if (Sys_LowPhysicalMemory()
760+
// For sub BSPs, always free immediately since caching only applies to main maps
761+
if ( newBuff && newBuff != gpvCachedMapDiskImage )
762+
{
763+
Z_Free(newBuff);
764+
}
765+
else if (Sys_LowPhysicalMemory()
761766
|| com_dedicated->integer
762767
// || we're on a big-endian machine
763768
)

0 commit comments

Comments
 (0)