diff options
author | bjarni <bjarni@openttd.org> | 2006-10-09 21:42:18 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-10-09 21:42:18 +0000 |
commit | 684c50d82f1ab4f356a4fb6653e8edd5ebfd0ed4 (patch) | |
tree | 4e1824f9fc84b0ddf401bbcc0ac2472e8d75a89c /train_gui.c | |
parent | 407d9792362f0f2727a3d8c051a1f034efa4b680 (diff) | |
download | openttd-684c50d82f1ab4f356a4fb6653e8edd5ebfd0ed4.tar.xz |
(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
Diffstat (limited to 'train_gui.c')
-rw-r--r-- | train_gui.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/train_gui.c b/train_gui.c index 7410ee5c4..b2b93ec57 100644 --- a/train_gui.c +++ b/train_gui.c @@ -432,8 +432,8 @@ static void GenerateBuildList(EngineID **engines, uint16 *num_engines, EngineID } /* 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) |