Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double delete in PILZ CIRC generation #1229

Merged
merged 1 commit into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ std::unique_ptr<KDL::Path> PathCircleGenerator::circleFromCenter(const KDL::Fram
}
catch (KDL::Error_MotionPlanning&)
{
delete rot_interpo; // in case we could not construct the Path object, avoid
// a memory leak
KDL::epsilon = old_kdl_epsilon;
throw; // and pass the exception on to the caller
}
Expand Down Expand Up @@ -121,22 +119,9 @@ std::unique_ptr<KDL::Path> PathCircleGenerator::circleFromInterim(const KDL::Fra
}

KDL::RotationalInterpolation* rot_interpo = new KDL::RotationalInterpolation_SingleAxis();
try
{
return std::unique_ptr<KDL::Path>(
std::make_unique<KDL::Path_Circle>(start_pose, center_point, kdl_aux_point, goal_pose.M, alpha, rot_interpo,
eqradius, true /* take ownership of RotationalInterpolation */));
}
catch (KDL::Error_MotionPlanning&) // LCOV_EXCL_START // The cases where
// KDL would throw are already handled
// above,
// we keep these lines to be safe
{
delete rot_interpo; // in case we could not construct the Path object, avoid
// a memory leak
throw; // and pass the exception on to the caller
// LCOV_EXCL_STOP
}
return std::unique_ptr<KDL::Path>(
std::make_unique<KDL::Path_Circle>(start_pose, center_point, kdl_aux_point, goal_pose.M, alpha, rot_interpo,
eqradius, true /* take ownership of RotationalInterpolation */));
}

double PathCircleGenerator::cosines(const double a, const double b, const double c)
Expand Down