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 Jul 29, 2020
1 parent af438bc commit 53052d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,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
1 change: 1 addition & 0 deletions rcl/src/rcl/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,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
2 changes: 2 additions & 0 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ rcl_subscription_init(
fail:
if (subscription->impl) {
allocator->deallocate(subscription->impl, allocator->state);
subscription->impl = NULL;
}
ret = fail_ret;
// Fall through to cleanup
Expand Down Expand Up @@ -229,6 +230,7 @@ rcl_subscription_fini(rcl_subscription_t * subscription, rcl_node_t * node)
result = RCL_RET_ERROR;
}
allocator.deallocate(subscription->impl, allocator.state);
subscription->impl = NULL;
}
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Subscription finalized");
return result;
Expand Down

0 comments on commit 53052d9

Please sign in to comment.