Skip to content

Commit

Permalink
Update nvhls_array.h
Browse files Browse the repository at this point in the history
Fix memory leak in make_permanent function.
  • Loading branch information
Stuart-Swan authored and ben-k committed Sep 19, 2024
1 parent cb86770 commit eb6e9dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmod/include/nvhls_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ static const char* make_permanent(const char* s) {
#ifdef __SYNTHESIS__
return s;
#else
std::string* str = new std::string(s); // this is an intentional memory leak..
return str->c_str();
static std::vector<std::string> vec_str;
vec_str.push_back(std::string(s));
return vec_str.back().c_str();
#endif
}

Expand Down

0 comments on commit eb6e9dd

Please sign in to comment.