Skip to content

Commit

Permalink
Tweaks to client.c and subscription.c for cleaner init/fini
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <brawner@gmail.com>
  • Loading branch information
brawner committed Aug 12, 2020
1 parent 5e9c24d commit 14dd881
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ rcl_client_init(
fail:
if (client->impl) {
allocator->deallocate(client->impl, allocator->state);
client->impl = NULL;
}
ret = fail_ret;
// Fall through to cleanup
Expand Down Expand Up @@ -223,6 +224,7 @@ rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
result = RCL_RET_ERROR;
}
allocator.deallocate(client->impl, allocator.state);
client->impl = NULL;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client finalized");
return result;
Expand Down
1 change: 1 addition & 0 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node)
result = RCL_RET_ERROR;
}
allocator.deallocate(publisher->impl, allocator.state);
publisher->impl = NULL;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Publisher finalized");
return result;
Expand Down
2 changes: 2 additions & 0 deletions rcl/src/rcl/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ rcl_service_init(
fail:
if (service->impl) {
allocator->deallocate(service->impl, allocator->state);
service->impl = NULL;
}
ret = fail_ret;
// Fall through to clean up
Expand Down Expand Up @@ -228,6 +229,7 @@ rcl_service_fini(rcl_service_t * service, rcl_node_t * node)
result = RCL_RET_ERROR;
}
allocator.deallocate(service->impl, allocator.state);
service->impl = NULL;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service finalized");
return result;
Expand Down

0 comments on commit 14dd881

Please sign in to comment.