mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
Fix memory leak in unit test
This commit is contained in:
parent
f070247a25
commit
58b1a020b5
@ -16,7 +16,10 @@ int create(int cost) {
|
|||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
int* create(int cost) {
|
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 <>
|
template <>
|
||||||
mtc::SolutionBasePtr create(int cost) {
|
mtc::SolutionBasePtr create(int cost) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user