Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[1.8.x] Backporting: Fixed setting attributes in reviewSubgraph #19278

Merged
merged 7 commits into from
Oct 6, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
changed string allocation from new to malloc to match free
  • Loading branch information
Ubuntu committed Oct 3, 2020
commit 1dd94381151b52c923f56406d3c707fe0ada1a59
5 changes: 3 additions & 2 deletions src/lib_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1593,8 +1593,9 @@ MX_INT_RET _passCallGraphPass(mxnet::ext::graphPass_t graphPass, const char *jso
mxnet::ext::MXReturnValue retval = graphPass(graph, opts);
if (!retval) return retval;

std::string *tmp = new std::string(graph->toString());
*out_graph = const_cast<char*>(tmp->c_str());
std::string tmp = graph->toString();
*out_graph = static_cast<char*>(malloc ((tmp.size()+1) * sizeof(char))); // NOLINT
snprintf((*out_graph), tmp.size()+1, "%s", tmp.c_str());
return retval;
}

Expand Down