Make sure to always check return values. (#840)

* Make sure to always check return values.

Pointed out by clang static analysis, we should always
check these return values.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
This commit is contained in:
Chris Lalancette 2020-10-29 08:15:52 -04:00 committed by Alejandro Hernández Cordero
parent fd2f427563
commit 1f7baf2ee5
2 changed files with 21 additions and 1 deletions

View file

@ -234,6 +234,10 @@ rcl_lifecycle_state_machine_init(
// init default state machine might have allocated memory,
// so we have to call fini
ret = rcl_lifecycle_state_machine_fini(state_machine, node_handle, allocator);
if (ret != RCL_RET_OK) {
RCUTILS_SAFE_FWRITE_TO_STDERR(
"Freeing state machine failed while handling a previous error. Leaking memory!\n");
}
return RCL_RET_ERROR;
}
}