From 565988844b912a4abf38b3cfbadcc7326041da13 Mon Sep 17 00:00:00 2001 From: "Tomoya.Fujita" Date: Tue, 9 Feb 2021 16:11:49 +0900 Subject: [PATCH 1/2] Fix runtime error: reference binding to null pointer of type Signed-off-by: Tomoya.Fujita --- rclcpp/include/rclcpp/subscription_options.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/subscription_options.hpp b/rclcpp/include/rclcpp/subscription_options.hpp index c3d509698d..ade1bb8e9f 100644 --- a/rclcpp/include/rclcpp/subscription_options.hpp +++ b/rclcpp/include/rclcpp/subscription_options.hpp @@ -104,7 +104,7 @@ struct SubscriptionOptionsWithAllocator : public SubscriptionOptionsBase rcl_subscription_options_t result = rcl_subscription_get_default_options(); using AllocatorTraits = std::allocator_traits; using MessageAllocatorT = typename AllocatorTraits::template rebind_alloc; - auto message_alloc = std::make_shared(*allocator.get()); + auto message_alloc = std::make_shared(*this->get_allocator().get()); result.allocator = allocator::get_rcl_allocator(*message_alloc); result.qos = qos.get_rmw_qos_profile(); result.rmw_subscription_options.ignore_local_publications = this->ignore_local_publications; From 157aee263ed11ff016adeb359876a3bdc80f0ae7 Mon Sep 17 00:00:00 2001 From: "Tomoya.Fujita" Date: Tue, 9 Feb 2021 16:18:51 +0900 Subject: [PATCH 2/2] delete cppcheck v1.89 workaround Signed-off-by: Tomoya.Fujita --- rclcpp/include/rclcpp/publisher_options.hpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rclcpp/include/rclcpp/publisher_options.hpp b/rclcpp/include/rclcpp/publisher_options.hpp index ff038d15f4..2e12c12bcb 100644 --- a/rclcpp/include/rclcpp/publisher_options.hpp +++ b/rclcpp/include/rclcpp/publisher_options.hpp @@ -95,12 +95,7 @@ struct PublisherOptionsWithAllocator : public PublisherOptionsBase get_allocator() const { if (!this->allocator) { - // TODO(wjwwood): I would like to use the commented line instead, but - // cppcheck 1.89 fails with: - // Syntax Error: AST broken, binary operator '>' doesn't have two operands. - // return std::make_shared(); - std::shared_ptr tmp(new Allocator()); - return tmp; + return std::make_shared(); } return this->allocator; }