Skip to content

Commit

Permalink
Deallocate enclave override env char upon error
Browse files Browse the repository at this point in the history
  • Loading branch information
ruffsl committed Apr 15, 2020
1 parent 2b917aa commit 549a6f7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rcl/src/rcl/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,15 @@ char * rcl_get_secure_root(
char * error_str = rcutils_get_env(ROS_SECURITY_KEYSTORE_VAR_NAME, &env_buf);
if (error_str) {
RCUTILS_LOG_ERROR("rcutils_get_env failed: %s\n", error_str);
allocator->deallocate(ros_secure_enclave_override_env, allocator->state);
return NULL;
}
if (!env_buf) {
allocator->deallocate(ros_secure_enclave_override_env, allocator->state);
return NULL;
}
if (0 == strcmp("", env_buf)) {
allocator->deallocate(ros_secure_enclave_override_env, allocator->state);
return NULL; // environment variable was empty
}
char * ros_secure_keystore_env = rcutils_strdup(env_buf, *allocator);
Expand Down

0 comments on commit 549a6f7

Please sign in to comment.