Skip to content

Commit

Permalink
fix(autoware_tensorrt_classifier): fix bugprone-exception-escape (#9732)
Browse files Browse the repository at this point in the history
fix: bugprone-error

Signed-off-by: kobayu858 <[email protected]>
  • Loading branch information
kobayu858 authored Dec 24, 2024
1 parent f3a258c commit a499a0a
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,15 @@ TrtClassifier::TrtClassifier(

TrtClassifier::~TrtClassifier()
{
if (m_cuda) {
if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
try {
if (m_cuda) {
if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
}
} catch (const std::exception & e) {
std::cerr << "Exception in TrtClassifier destructor: " << e.what() << std::endl;
} catch (...) {
std::cerr << "Unknown exception in TrtClassifier destructor" << std::endl;
}
}

Expand Down

0 comments on commit a499a0a

Please sign in to comment.