Skip to content

Commit a091a03

Browse files
committed
fix memory issues
1 parent fda2db9 commit a091a03

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/ecos/scenario/parse_scenario_node.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
inline std::unique_ptr<ecos::scenario> parse_scenario_node(const pugi::xml_node& root, size_t& numActions)
1212
{
13-
std::unique_ptr<ecos::scenario> parsed_scenario;
13+
auto parsed_scenario = std::make_unique<ecos::scenario>();
1414

1515
if (const auto nameAttr = root.attribute("name")) {
1616
parsed_scenario->name = nameAttr.as_string();

src/ecos/ssp/ssp_loader.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,15 @@ class ssp_based_simulation_structure : public simulation_structure
7676
}
7777

7878
if (auto ex = desc_.defaultExperiment) {
79-
auto annotations = ex->annotations;
79+
const auto& annotations = ex->annotations;
8080
for (const auto& annotation : annotations) {
8181
if (annotation.type == "com.github.ecos-platform.scenario") {
8282

83-
8483
size_t numActions{};
8584
const auto root = annotation.node.child("ecos:Scenario");
8685
auto parsed_scenario = parse_scenario_node(root, numActions);
86+
log::debug("Adding scenario '{}' with {} actions to SystemStructure", parsed_scenario->name, numActions);
8787
add_scenario(std::move(parsed_scenario));
88-
log::debug("Added scenario '{}' with {} actions to SystemStructure", parsed_scenario->name, numActions);
8988
}
9089
}
9190
}

0 commit comments

Comments
 (0)