mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
(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
This commit is contained in:
parent
772d7c9fb3
commit
d620997bb3
@ -432,8 +432,8 @@ static void GenerateBuildList(EngineID **engines, uint16 *num_engines, EngineID
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reduce array sizes if they are too big */
|
/* Reduce array sizes if they are too big */
|
||||||
if (*num_engines == engine_length) *engines = realloc((void*)*engines, (*num_engines) * sizeof((*engines)[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]));
|
if (*num_wagons != wagon_length) *wagons = realloc((void*)*wagons, (*num_wagons) * sizeof((*wagons)[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SortTrainBuildList(Window *w)
|
static void SortTrainBuildList(Window *w)
|
||||||
|
Loading…
Reference in New Issue
Block a user