diff --git a/Kernel/Syscalls/alarm.cpp b/Kernel/Syscalls/alarm.cpp index d6847c1fbd..3ffb2d8f53 100644 --- a/Kernel/Syscalls/alarm.cpp +++ b/Kernel/Syscalls/alarm.cpp @@ -30,9 +30,7 @@ KResultOr Process::sys$alarm(unsigned seconds) auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE); deadline = deadline + Time::from_seconds(seconds); if (!m_alarm_timer) { - m_alarm_timer = adopt_ref_if_nonnull(new (nothrow) Timer()); - if (!m_alarm_timer) - return ENOMEM; + m_alarm_timer = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Timer)); } auto timer_was_added = TimerQueue::the().add_timer_without_id(*m_alarm_timer, CLOCK_REALTIME_COARSE, deadline, [this]() { [[maybe_unused]] auto rc = send_signal(SIGALRM, nullptr);