(svn r6709) -Fix r6679: [build train window] solved an issue that could lead to trailing empty blocks in the list array
authorbjarni
Mon, 09 Oct 2006 21:42:18 +0000
changeset 4788 76ed308037b1
parent 4787 5eaa3e93cf24
child 4789 94751a1d302b
(svn r6709) -Fix r6679: [build train window] solved an issue that could lead to trailing empty blocks in the list array
Since they were freed with the rest of the array, it only meant that we wasted a few bytes (max 16) while the window were open and we didn't leak memory
train_gui.c
--- a/train_gui.c	Mon Oct 09 21:30:16 2006 +0000
+++ b/train_gui.c	Mon Oct 09 21:42:18 2006 +0000
@@ -432,8 +432,8 @@
 	}
 
 	/* Reduce array sizes if they are too big */
-	if (*num_engines == engine_length) *engines = realloc((void*)*engines, (*num_engines) * sizeof((*engines)[0]));
-	if (*num_wagons == wagon_length) *wagons = realloc((void*)*wagons, (*num_wagons) * sizeof((*wagons)[0]));
+	if (*num_engines != engine_length) *engines = realloc((void*)*engines, (*num_engines) * sizeof((*engines)[0]));
+	if (*num_wagons  != wagon_length)  *wagons  = realloc((void*)*wagons,  (*num_wagons)  * sizeof((*wagons)[0]));
 }
 
 static void SortTrainBuildList(Window *w)