From b889e7fe2d2b1162bad9cf39831e1becf3d9e480 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 3 Mar 2018 18:37:54 +0300 Subject: Fix memory leak in unit tests. --- src/unittests/utils/itemxmlutils.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/unittests/utils/itemxmlutils.cc b/src/unittests/utils/itemxmlutils.cc index 825bc2f97..84512b5be 100644 --- a/src/unittests/utils/itemxmlutils.cc +++ b/src/unittests/utils/itemxmlutils.cc @@ -35,6 +35,7 @@ #include "utils/delete2.h" #include "utils/env.h" +#include "utils/foreach.h" #include "utils/xml.h" #include "utils/itemxmlutils.h" @@ -206,6 +207,10 @@ TEST_CASE("itemxmlutils readItemStatsString 1", "") REQUIRE(effect == "Weight -2"); } + FOR_EACH(ItemFieldInfos::iterator, it, fields) + { + delete (*it).second; + } delete2(userPalette); delete2(theme); delete2(client); @@ -404,6 +409,10 @@ TEST_CASE("itemxmlutils readItemStatsVector 1", "") REQUIRE(effect[0] == "Weight -2"); } + FOR_EACH(ItemFieldInfos::iterator, it, fields) + { + delete (*it).second; + } delete2(userPalette); delete2(theme); delete2(client); -- cgit v1.2.3-70-g09d2