From 803e8970c344bc3f2233115ac2920d17d541c077 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 21 Aug 2015 23:33:48 +0100 Subject: [PATCH] Departures: Fix major memory leak in MakeDepartureList. --- src/departures.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/departures.cpp b/src/departures.cpp index 1b24a88bac..775f1fb364 100644 --- a/src/departures.cpp +++ b/src/departures.cpp @@ -639,6 +639,12 @@ DepartureList* MakeDepartureList(StationID station, bool show_vehicle_types[5], } } + /* Avoid leaking OrderDate structs */ + for (uint i = 0; i < next_orders.Length(); ++i) { + OrderDate *od = *(next_orders.Get(i)); + delete od; + } + /* Done. Phew! */ return result; }