Skip to content

Commit

Permalink
Check the rcl_action return value on cleanup.
Browse files Browse the repository at this point in the history
And add an error message as appropriate.  clang static
analysis pointed out that this was a dead store.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Jan 26, 2021
1 parent eec0628 commit 0b305b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rclpy/src/rclpy/_rclpy_action.c
Expand Up @@ -1575,11 +1575,16 @@ rclpy_action_process_cancel_request(PyObject * Py_UNUSED(self), PyObject * args)
action_server, cancel_request, &cancel_response);
destroy_cancel_request(cancel_request);
if (RCL_RET_OK != ret) {
const char * original_error = rcl_get_error_string().str;
const char * extra_error = "";
ret = rcl_action_cancel_response_fini(&cancel_response);
if (RCL_RET_OK != ret) {
extra_error = ". Also failed to cleanup response.";
}
PyErr_Format(
PyExc_RuntimeError,
"Failed to process cancel request: %s",
rcl_get_error_string().str);
"Failed to process cancel request: %s%s",
original_error, extra_error);
rcl_reset_error();
return NULL;
}
Expand Down

0 comments on commit 0b305b9

Please sign in to comment.