diff --git a/rcl/src/rcl/client.c b/rcl/src/rcl/client.c index 9bf70dc4a2..6258d38570 100644 --- a/rcl/src/rcl/client.c +++ b/rcl/src/rcl/client.c @@ -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; diff --git a/rcl/src/rcl/subscription.c b/rcl/src/rcl/subscription.c index 2e3b37d384..83288ff683 100644 --- a/rcl/src/rcl/subscription.c +++ b/rcl/src/rcl/subscription.c @@ -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 @@ -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;