1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

cpu/native: timer: Delete POSIX timer upon error

If `register_interrupt` somehow fails, we leak the already created
POSIX timer by returning immediately.

Fix this by calling `timer_delete` before returning.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
This commit is contained in:
Armin Wolf 2024-01-30 20:06:32 +01:00
parent eac719166b
commit d8dc6d3963

View File

@ -121,6 +121,7 @@ int timer_init(tim_t dev, uint32_t freq, timer_cb_t cb, void *arg)
if (register_interrupt(SIGALRM, native_isr_timer) != 0) {
DEBUG_PUTS("Failed to register SIGALRM handler");
timer_delete(itimer_monotonic);
return -1;
}