Skip to content

Commit

Permalink
reset wait_set type index in SET_RESIZE (#207)
Browse files Browse the repository at this point in the history
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 <jing.j.wang@intel.com>
  • Loading branch information
jwang11 authored and wjwwood committed Jan 19, 2018
1 parent c09f642 commit 4ed6c56
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rcl/src/rcl/wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down

0 comments on commit 4ed6c56

Please sign in to comment.