From 456d2942b64ddfc1a7b985ddc609f8c72d888440 Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Sat, 11 Nov 2023 17:39:00 +0100 Subject: [PATCH] finally fixing memory leak fix #14034 --- src/router/ROPerson.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/router/ROPerson.cpp b/src/router/ROPerson.cpp index 8a76dfabbe66..86c648f09ba9 100644 --- a/src/router/ROPerson.cpp +++ b/src/router/ROPerson.cpp @@ -416,13 +416,13 @@ ROPerson::computeRoute(const RORouterProvider& provider, } if (cost < bestCost) { bestCost = cost; - while (!best.empty()) { - delete best.back(); - best.pop_back(); - } - best.swap(resultItems); bestVeh = carUsed ? v : nullptr; + best.swap(resultItems); + } + for (TripItem* const it : resultItems) { + delete it; } + resultItems.clear(); } } trip->setItems(best, bestVeh);