Skip to content

Commit

Permalink
Added pointer deletion in destructor and minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
timonh committed Jan 4, 2021
1 parent 2cd3056 commit 9e3f705
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions darknet_ros/src/yolo_object_detector_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* yolo_object_detector_nodelet.cpp
*
* Created on: Dec 19, 2016
* Author: Marko Bjelonic
* Author: Marko Bjelonic
* Institute: ETH Zurich, Robotic Systems Lab
*/

Expand All @@ -14,16 +11,18 @@
class DarknetRosNodelet : public nodelet::Nodelet {
public:
DarknetRosNodelet() = default;
~DarknetRosNodelet() = default;
~DarknetRosNodelet() {
if (darknetRos_) delete darknetRos_;
}

private:
virtual void onInit() {
ros::NodeHandle NodeHandle("~");
NodeHandle = getPrivateNodeHandle();
darknet_ros_ = new darknet_ros::YoloObjectDetector(NodeHandle);
darknetRos_ = new darknet_ros::YoloObjectDetector(NodeHandle);
}

darknet_ros::YoloObjectDetector* darknet_ros_;
darknet_ros::YoloObjectDetector* darknetRos_;
};

// Declare as a Plug-in
Expand Down

0 comments on commit 9e3f705

Please sign in to comment.