halflife
halflife copied to clipboard
[Condition Zero] Material system leaks memory when parsing configuration files
When the material system parses configuration data from material files it frees the file's contents incorrectly. The function MAT_SetDefaults
loads the file, parses the data and then passes a null pointer to gEngfuncs.COM_FreeFile
.
The cause is the same as #1729: the original pointer is modified during parsing, parsing doesn't end until the pointer becomes null at which point it is passed to gEngfuncs.COM_FreeFile
.
The function also doesn't free the memory if the file syntax is incorrect, as it will return from the function without calling FreeFile
.
This affects both Condition Zero and Deleted Scenes.
The LoadLevelMaterials
function also frees a file buffer incorrectly due to the same parsing-related mistake.