This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 844398c8631a7bbd9a55bc16c3acfee73da517ac Author: Masaori Koshiba <[email protected]> AuthorDate: Tue Apr 23 07:20:52 2024 +0900 Add nullptr guards in ActivityCop functions (#11266) * Add nullptr guards in ActivityCop functions * Set nullptr after canceling event (cherry picked from commit 1cea2154722f302dde35668e1766586a8d9c717e) --- include/iocore/net/NetTimeout.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/iocore/net/NetTimeout.h b/include/iocore/net/NetTimeout.h index b10570994b..8cef2a804a 100644 --- a/include/iocore/net/NetTimeout.h +++ b/include/iocore/net/NetTimeout.h @@ -219,14 +219,19 @@ template <class T, class List> inline void ActivityCop<T, List>::start() { - _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq)); + if (_event == nullptr) { + _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq)); + } } template <class T, class List> inline void ActivityCop<T, List>::stop() { - _event->cancel(); + if (_event != nullptr) { + _event->cancel(); + _event = nullptr; + } } template <class T, class List>
