Skip to content

Commit

Permalink
Check rcutils_strdup() outcome immediately. (#768)
Browse files Browse the repository at this point in the history
Within rcl_node_init() implementation.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
  • Loading branch information
hidmic authored and ahcorde committed Nov 2, 2020
1 parent 9be4fe9 commit 14ef8e0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rcl/src/rcl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ rcl_init(
context->impl->init_options.impl->rmw_init_options.enclave = rcutils_strdup(
"/", context->impl->allocator);
}

if (!context->impl->init_options.impl->rmw_init_options.enclave) {
RCL_SET_ERROR_MSG("failed to set context name");
fail_ret = RCL_RET_BAD_ALLOC;
goto fail;
}

int validation_result;
size_t invalid_index;
ret = rcl_validate_enclave_name(
Expand All @@ -195,12 +202,6 @@ rcl_init(
goto fail;
}

if (!context->impl->init_options.impl->rmw_init_options.enclave) {
RCL_SET_ERROR_MSG("failed to set context name");
fail_ret = RCL_RET_BAD_ALLOC;
goto fail;
}

rmw_security_options_t * security_options =
&context->impl->init_options.impl->rmw_init_options.security_options;
ret = rcl_get_security_options_from_environment(
Expand Down

0 comments on commit 14ef8e0

Please sign in to comment.