File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ extern "C"
2828#include "rcutils/stdatomic_helper.h"
2929#include "rmw/error_handling.h"
3030
31- static atomic_uint_least64_t __rcl_next_unique_id = ATOMIC_VAR_INIT (0 );
31+ static atomic_uint_least64_t __rcl_next_unique_id = ATOMIC_VAR_INIT (1 );
3232
3333rcl_ret_t
3434rcl_init (
@@ -72,6 +72,8 @@ rcl_init(
7272 context -> impl = allocator .allocate (sizeof (rcl_context_impl_t ), allocator .state );
7373 RCL_CHECK_FOR_NULL_WITH_MSG (
7474 context -> impl , "failed to allocate memory for context impl" , return RCL_RET_BAD_ALLOC );
75+ // memset to 0 so the cleanup function will not try to clean up uninitialized parts later
76+ memset (context -> impl , 0x0 , sizeof (rcl_context_impl_t ));
7577
7678 // Copy the options into the context for future reference.
7779 rcl_ret_t ret = rcl_init_options_copy (options , & (context -> impl -> init_options ));
You can’t perform that action at this time.
0 commit comments