From 7473cef063b24186dd7712a48a49eb047b615793 Mon Sep 17 00:00:00 2001 From: Celestar Date: Tue, 8 Mar 2005 16:27:26 +0000 Subject: (svn r1959) -Fix: Repaired two memleaks I have hacked :( --- roadveh_cmd.c | 5 ++++- train_cmd.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 93f6927a1..fb078b174 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -1697,8 +1697,11 @@ void OnNewDay_RoadVeh(Vehicle *v) //We do not have a slot, so make one if (v->u.road.slot == NULL) { //first we need to find out how far our stations are away. - if ( rs == NULL ) + if ( rs == NULL ) { + free(firststop); + firststop = stop = NULL; goto no_stop; + } DEBUG(ms, 2) ("Multistop: Attempting to obtain a slot for vehicle %d at station %d (0x%x)", v->unitnumber, st->index, st->xy); do { diff --git a/train_cmd.c b/train_cmd.c index 5aa0ed2bc..683022538 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -131,6 +131,9 @@ static int GetTrainAcceleration(Vehicle *v, bool mode) sum += dist[i]; } + free(dist); + dist = NULL; + if (numcurve > 0) { sum /= numcurve; } -- cgit v1.2.3-70-g09d2