Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if pointers are null before calling memset #290

Merged
merged 1 commit into from
Aug 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions rcl/src/rcl/wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,25 @@ rcl_wait_set_get_allocator(const rcl_wait_set_t * wait_set, rcl_allocator_t * al

#define SET_CLEAR(Type) \
do { \
memset( \
(void *)wait_set->Type ## s, \
0, \
sizeof(rcl_ ## Type ## _t *) * wait_set->size_of_ ## Type ## s); \
wait_set->impl->Type ## _index = 0; \
if (NULL != wait_set->Type ## s) { \
memset( \
(void *)wait_set->Type ## s, \
0, \
sizeof(rcl_ ## Type ## _t *) * wait_set->size_of_ ## Type ## s); \
wait_set->impl->Type ## _index = 0; \
} \
} while (false)

#define SET_CLEAR_RMW(Type, RMWStorage, RMWCount) \
do { \
/* Also clear the rmw storage. */ \
memset( \
wait_set->impl->RMWStorage, \
0, \
sizeof(void *) * wait_set->impl->RMWCount); \
wait_set->impl->RMWCount = 0; \
if (NULL != wait_set->impl->RMWStorage) { \
/* Also clear the rmw storage. */ \
memset( \
wait_set->impl->RMWStorage, \
0, \
sizeof(void *) * wait_set->impl->RMWCount); \
wait_set->impl->RMWCount = 0; \
} \
} while (false)

#define SET_RESIZE(Type, ExtraDealloc, ExtraRealloc) \
Expand Down