Skip to content

Commit

Permalink
Set the value of is_available before entering the loop. (#173)
Browse files Browse the repository at this point in the history
clang static analysis pointed out that if we never did *any*
iterations of the loop in SLEEP_AND_RETRY_UNTIL, then we
would be comparing an uninitialized value of is_available with
false.  Just set it to false in this unlikely case.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Feb 2, 2021
1 parent c91768a commit 55b893d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test_rmw_implementation/test/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ TEST_F(CLASSNAME(TestClientUse, RMW_IMPLEMENTATION), service_server_is_available

TEST_F(CLASSNAME(TestClientUse, RMW_IMPLEMENTATION), service_server_is_available_good_args)
{
bool is_available;
bool is_available = false;
rmw_ret_t ret = RMW_RET_ERROR;
SLEEP_AND_RETRY_UNTIL(rmw_intraprocess_discovery_delay, rmw_intraprocess_discovery_delay * 10) {
ret = rmw_service_server_is_available(node, client, &is_available);
Expand Down

0 comments on commit 55b893d

Please sign in to comment.