From 78a5715bf1003d1332037252ffd90475eaf5d303 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 18 Aug 2024 20:57:33 +0100 Subject: [PATCH] Codefix: Delete PersistentStorage when a town is deleted. --- src/town_cmd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 44679fbf19..ee4b69613f 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -148,6 +148,9 @@ Town::~Town() } /* Clear the persistent storage list. */ + for (auto &psa : this->psa_list) { + delete psa; + } this->psa_list.clear(); DeleteSubsidyWith(SourceType::Town, this->index);