Changeset - r5351:78ec7c00eea3
[Not reviewed]
master
0 1 0
Darkvater - 17 years ago 2006-12-21 10:09:43
darkvater@openttd.org
(svn r7522) -Codechange: Have CopyGRFConfigList clear the destination list before assigning
values to it. This cuts down on memleaks which could exist when the function was
not used carefully.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
newgrf_config.c
Show inline comments
 
@@ -115,6 +115,8 @@ GRFConfig **CopyGRFConfigList(GRFConfig 
 
{
 
	GRFConfig *c;
 

	
 
	/* Clear destination as it will be overwritten */
 
	ClearGRFConfigList(dst);
 
	for (; src != NULL; src = src->next) {
 
		c = calloc(1, sizeof(*c));
 
		*c = *src;
 
@@ -135,8 +137,6 @@ void ResetGRFConfig(bool defaults)
 
{
 
	GRFConfig **c = &_grfconfig;
 

	
 
	ClearGRFConfigList(c);
 

	
 
	if (defaults) c = CopyGRFConfigList(c, _grfconfig_newgame);
 
	CopyGRFConfigList(c, _grfconfig_static);
 
}
0 comments (0 inline, 0 general)