You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new time jump handler is registered in the clock.
Actual behavior
The new time jump handler is not registered in the clock, allocator.realloc() fails inside rcl_clock_add_jump_callback().
I suppose this originates in rcl_clock.jump_callbacks pointing to freed memory after rcl_clock_remove_jump_callback() has been called.
Reallocating a pointer that points to freed memory seems to be undefined behavior according to cppreference.
Additional information
One possible fix for this issue could be to use malloc() instead of realloc() in rcl_clock_add_jump_callback() if rcl_clock.num_jump_callbacks == 0.
@sloretz I think this functionality has been introduced in #284, any ideas?
The text was updated successfully, but these errors were encountered:
Oops. I think the bug could be fixed by setting rcl_clock.jump_callbacks to NULL when removing the last callback. allocator.reallocate(NULL, ...)is required to succeed which I think is meant to say it behaves like stdlib realloc and is the same as calling malloc().
Bug report
Required Info:
https://github.com/ros2/ros2/blob/13ee60a815f170d689ffb323e4c3c2747a72407f/ros2.repos
Steps to reproduce issue
Condensed example:
Expected behavior
The new time jump handler is registered in the clock.
Actual behavior
The new time jump handler is not registered in the clock,
allocator.realloc()
fails insidercl_clock_add_jump_callback()
.I suppose this originates in
rcl_clock.jump_callbacks
pointing to freed memory afterrcl_clock_remove_jump_callback()
has been called.Reallocating a pointer that points to freed memory seems to be undefined behavior according to cppreference.
Additional information
One possible fix for this issue could be to use
malloc()
instead ofrealloc()
inrcl_clock_add_jump_callback()
ifrcl_clock.num_jump_callbacks == 0
.@sloretz I think this functionality has been introduced in #284, any ideas?
The text was updated successfully, but these errors were encountered: