Skip to content

Commit

Permalink
increase exception safety
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBurmark committed Feb 10, 2025
1 parent 9963841 commit 5361044
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/RAJA/pattern/kernel/InitLocalMem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <iostream>
#include <type_traits>
#include <memory>

namespace RAJA
{
Expand Down Expand Up @@ -83,15 +84,14 @@ struct StatementExecutor<statement::InitLocalMem<RAJA::cpu_tile_mem,
Pos, typename camp::decay<Data>::param_tuple_t>::value_type;

// Initialize memory
varType* ptr = new varType[camp::get<Pos>(data.param_tuple).size()];
camp::get<Pos>(data.param_tuple).set_data(ptr);
auto local_mem = make_unique<varType[]>(camp::get<Pos>(data.param_tuple).size());
camp::get<Pos>(data.param_tuple).set_data(local_mem.get());

// Initialize others and execute
exec_expanded<others...>(data);

// Cleanup and return
camp::get<Pos>(data.param_tuple).set_data(nullptr);
delete[] ptr;
}

template<typename Data>
Expand Down

0 comments on commit 5361044

Please sign in to comment.