Skip to content

Commit ecedb50

Browse files
committed
Change allocator call
Signed-off-by: Jorge Perez <[email protected]>
1 parent bbe6241 commit ecedb50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rcl/test/rcl/test_rmw_impl_id_check_func.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ TEST(TestRmwCheck, test_mock_rmw_impl_check) {
123123
const char * get_env_id_matches_name = rcutils_get_env(
124124
RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME,
125125
&expected_rmw_id_matches);
126-
EXPECT_FALSE(get_env_id_matches_name);
126+
EXPECT_EQ(NULL, get_env_id_matches_name);
127127
EXPECT_TRUE(rcutils_set_env(RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME, "some_random_name"));
128128

129129
// Return an allocated string as strdup would do for the first case
130130
// calling the function
131131
rcl_allocator_t allocator = rcl_get_default_allocator();
132132
size_t dummy_str_size = 3u;
133-
char * new_string = static_cast<char *>(allocator.allocate(dummy_str_size, allocator.state));
134-
memset(new_string, '\0', dummy_str_size);
133+
char * new_string = static_cast<char *>(allocator.zero_allocate(
134+
dummy_str_size, 1u, allocator.state));
135135

136136
auto mock = mocking_utils::patch(
137137
"lib:rcl", rcutils_strdup, [&new_string](auto...) {

0 commit comments

Comments
 (0)