Skip to content

Commit 68a356e

Browse files
committed
Fix redefinition of get_env_error_str
Signed-off-by: ruffsl <roxfoxpox@gmail.com>
1 parent 3e067b4 commit 68a356e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

rcl/src/rcl/security.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,12 @@ char * rcl_get_secure_root(
139139
if (NULL == name) {
140140
return NULL;
141141
}
142-
142+
143+
const char * get_env_error_str = NULL;
143144
// check if enclave override environment variable is empty
144-
char * error_str = rcutils_get_env(ROS_SECURITY_ENCLAVE_OVERRIDE, &env_buf);
145-
if (error_str) {
146-
RCUTILS_LOG_ERROR("rcutils_get_env failed: %s\n", error_str);
145+
get_env_error_str = rcutils_get_env(ROS_SECURITY_ENCLAVE_OVERRIDE, &env_buf);
146+
if (NULL != get_env_error_str) {
147+
RCUTILS_LOG_ERROR("rcutils_get_env failed: %s\n", get_env_error_str);
147148
return NULL;
148149
}
149150
if (!env_buf) {
@@ -155,9 +156,9 @@ char * rcl_get_secure_root(
155156
char * ros_secure_enclave_override_env = rcutils_strdup(env_buf, *allocator);
156157

157158
// check if keystore environment variable is empty
158-
char * error_str = rcutils_get_env(ROS_SECURITY_KEYSTORE_VAR_NAME, &env_buf);
159-
if (error_str) {
160-
RCUTILS_LOG_ERROR("rcutils_get_env failed: %s\n", error_str);
159+
get_env_error_str = rcutils_get_env(ROS_SECURITY_KEYSTORE_VAR_NAME, &env_buf);
160+
if (NULL != get_env_error_str) {
161+
RCUTILS_LOG_ERROR("rcutils_get_env failed: %s\n", get_env_error_str);
161162
allocator->deallocate(ros_secure_enclave_override_env, allocator->state);
162163
return NULL;
163164
}

0 commit comments

Comments
 (0)