Fix memory leak in unit test

This commit is contained in:
v4hn 2021-05-27 14:19:38 +02:00 committed by Robert Haschke
parent f070247a25
commit 58b1a020b5

View File

@ -16,7 +16,10 @@ int create(int cost) {
}
template <>
int* create(int cost) {
return new int(cost);
// return new int(cost), but store values for clean memory management
static std::list<int> storage;
storage.push_back(cost);
return &storage.back();
}
template <>
mtc::SolutionBasePtr create(int cost) {