From 4ed6c56edd9244613f5585409a43def0f41a7821 Mon Sep 17 00:00:00 2001 From: jwang11 Date: Fri, 19 Jan 2018 10:49:46 +0800 Subject: [PATCH] reset wait_set type index in SET_RESIZE (#207) It is dangerous to keep type index float when do SET_RESIZE. It is possible that index greater than new size. Thus, set index to 0. Signed-off-by: jwang --- rcl/src/rcl/wait.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rcl/src/rcl/wait.c b/rcl/src/rcl/wait.c index 2a23d099e..8ab0bbc47 100644 --- a/rcl/src/rcl/wait.c +++ b/rcl/src/rcl/wait.c @@ -296,6 +296,7 @@ rcl_wait_set_get_allocator(const rcl_wait_set_t * wait_set, rcl_allocator_t * al } \ rcl_allocator_t allocator = wait_set->impl->allocator; \ wait_set->size_of_ ## Type ## s = 0; \ + wait_set->impl->Type ## _index = 0; \ if (size == 0) { \ if (wait_set->Type ## s) { \ allocator.deallocate((void *)wait_set->Type ## s, allocator.state); \