Skip to content

Commit 38293af

Browse files
author
Chris Friedt
committed
posix: timers: correct pointer passed to k_mem_slab_free()
If it is not possible to create a timer in timer_create(), then the timer_obj associated with the timer must be freed. However, the address of the pointer was mistakenly being passed to k_mem_slab_free() rather than simply the the pointer. This caused a crash in tests which can easily be avoided by passing the pointer rather than the address of the pointer. Signed-off-by: Chris Friedt <[email protected]>
1 parent 781011b commit 38293af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/posix/options/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)
190190
goto out;
191191

192192
free_timer:
193-
k_mem_slab_free(&posix_timer_slab, (void *)&timer);
193+
k_mem_slab_free(&posix_timer_slab, (void *)timer);
194194

195195
out:
196196
return ret;

0 commit comments

Comments
 (0)