Skip to content

Commit

Permalink
Ensure SYSTEM_STATS_INCREMENT only on successful Timer allocation in …
Browse files Browse the repository at this point in the history
…SystemTimer.h (#36690)

* Fix: Ensure SYSTEM_STATS_INCREMENT only on successful Timer allocation

* Update SystemTimer.h
  • Loading branch information
BoB13-Matter authored Dec 2, 2024
1 parent e7b0989 commit 4c69001
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/system/SystemTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ class TimerPool
Timer * Create(Layer & systemLayer, System::Clock::Timestamp awakenTime, TimerCompleteCallback onComplete, void * appState)
{
Timer * timer = mTimerPool.CreateObject(systemLayer, awakenTime, onComplete, appState);
SYSTEM_STATS_INCREMENT(Stats::kSystemLayer_NumTimers);
if (timer != nullptr)
{
SYSTEM_STATS_INCREMENT(Stats::kSystemLayer_NumTimers);
}

return timer;
}

Expand Down

0 comments on commit 4c69001

Please sign in to comment.