Skip to content

Commit

Permalink
Fix: crash while destructing crmorch (sonic-net#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiluo-msft authored Dec 21, 2018
1 parent 998b4ab commit 5803a8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ CrmOrch::CrmOrch(DBConnector *db, string tableName):
// The CRM stats needs to be populated again
m_countersCrmTable->del(CRM_COUNTERS_TABLE_KEY);

auto executor = new ExecutableTimer(m_timer.get(), this, "CRM_COUNTERS_POLL");
// Note: ExecutableTimer will hold m_timer pointer and release the object later
auto executor = new ExecutableTimer(m_timer, this, "CRM_COUNTERS_POLL");
Orch::addExecutor(executor);
m_timer->start();
}
Expand Down
2 changes: 1 addition & 1 deletion orchagent/crmorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CrmOrch : public Orch
private:
shared_ptr<DBConnector> m_countersDb = nullptr;
shared_ptr<Table> m_countersCrmTable = nullptr;
shared_ptr<SelectableTimer> m_timer = nullptr;
SelectableTimer *m_timer = nullptr;

struct CrmResourceCounter
{
Expand Down

0 comments on commit 5803a8c

Please sign in to comment.