Skip to content

Commit f3fa8cb

Browse files
author
Mauro Passerino
committed
Fix cppcheck
error: deallocuse - Dereferencing 'node_ptr' after it is deallocated / released Seems that: NodeBaseInterface::WeakPtr node_weak_ptr(node_ptr); causes the cppcheck to fail if node_ptr is used after creating the weak pointer from it.
1 parent ba9fee0 commit f3fa8cb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ EventsExecutorEntitiesCollector::add_callback_group(
142142
set_guard_condition_callback(node_ptr->get_notify_guard_condition());
143143

144144
// Store node's notify guard condition
145-
rclcpp::node_interfaces::NodeBaseInterface::WeakPtr node_weak_ptr(node_ptr);
146-
weak_nodes_to_guard_conditions_[node_weak_ptr] = node_ptr->get_notify_guard_condition();
145+
weak_nodes_to_guard_conditions_[node_ptr] = node_ptr->get_notify_guard_condition();
147146
}
148147

149148
// Add callback group to weak_groups_to_node

0 commit comments

Comments
 (0)