diff --git a/rcl/src/rcl/subscription.c b/rcl/src/rcl/subscription.c index fd5984ded..5e95fe72b 100644 --- a/rcl/src/rcl/subscription.c +++ b/rcl/src/rcl/subscription.c @@ -91,10 +91,11 @@ rcl_subscription_init( ROS_PACKAGE_NAME, "Expanded and remapped topic name '%s'", remapped_topic_name); // Allocate memory for the implementation struct. - subscription->impl = (rcl_subscription_impl_t *)allocator->zero_allocate( - 1, sizeof(rcl_subscription_impl_t), allocator->state); + subscription->impl = (rcl_subscription_impl_t *)allocator->allocate( + sizeof(rcl_subscription_impl_t), allocator->state); RCL_CHECK_FOR_NULL_WITH_MSG( subscription->impl, "allocating memory failed", ret = RCL_RET_BAD_ALLOC; goto cleanup); + memset(subscription->impl, 0, sizeof(rcl_subscription_impl_t)); // Fill out the implemenation struct. // rmw_handle // TODO(wjwwood): pass allocator once supported in rmw api.