Skip to content

Commit

Permalink
Merge pull request #26 from koide3/leak
Browse files Browse the repository at this point in the history
fix memory leak
  • Loading branch information
koide3 authored Oct 22, 2024
2 parents 53743e6 + 4e9d9ac commit 13d3bb7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class IncrementalFixedLagSmootherExtWithFallback : public IncrementalFixedLagSmo
template <class VALUE>
VALUE calculateEstimate(Key key) const {
try {
const auto& value = smoother->calculateEstimate(key);
const VALUE value = smoother->calculateEstimate<VALUE>(key);
auto found = values.find(key);
if (found != values.end()) {
found->value = value;
values.insert_or_assign(key, value);
}

return value.cast<VALUE>();
return value;
} catch (std::exception& e) {
std::cerr << "warning: an exception was caught in fixed-lag smoother update!!" << std::endl;
std::cerr << " : " << e.what() << std::endl;
Expand Down

0 comments on commit 13d3bb7

Please sign in to comment.