diff --git a/rclcpp/include/rclcpp/publisher.hpp b/rclcpp/include/rclcpp/publisher.hpp index c6f16643c6..0bc9e0aeb7 100644 --- a/rclcpp/include/rclcpp/publisher.hpp +++ b/rclcpp/include/rclcpp/publisher.hpp @@ -320,7 +320,7 @@ class Publisher : public PublisherBase { if (!intra_process_is_enabled_) { // In this case we're not using intra process. - auto ros_msg_ptr = std::make_unique(); + auto ros_msg_ptr = create_ros_message_unique_ptr(); rclcpp::TypeAdapter::convert_to_ros_message(*msg, *ros_msg_ptr); this->do_inter_process_publish(*ros_msg_ptr); return; @@ -367,7 +367,7 @@ class Publisher : public PublisherBase { if (!intra_process_is_enabled_) { // Convert to the ROS message equivalent and publish it. - auto ros_msg_ptr = std::make_unique(); + auto ros_msg_ptr = create_ros_message_unique_ptr(); rclcpp::TypeAdapter::convert_to_ros_message(msg, *ros_msg_ptr); this->do_inter_process_publish(*ros_msg_ptr); return;