Mercurial > hg > openttd
changeset 4788:9b6499f8f115 draft
(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
author | bjarni <bjarni@openttd.org> |
---|---|
date | Mon, 09 Oct 2006 21:42:18 +0000 |
parents | 1364acbb08cb |
children | 0eca1b371d13 |
files | train_gui.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/train_gui.c +++ b/train_gui.c @@ -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)