fix issue I3TTBJ

heap_use_after_free cause coredump
This commit is contained in:
zhangzhaoju 2021-06-02 15:07:15 +08:00
parent 643a25e03b
commit ed5b69179c
2 changed files with 9 additions and 1 deletions

View File

@ -397,7 +397,14 @@ py::dict ExecutorPy::GetAllreduceFusion(const std::string &phase) {
return mindspore::parallel::GetAllreduceFusion(graph);
}
// Not support multi thread, not support nested call too.
// Here using nested_called flg to avoid nested call.
void ExecutorPy::DelNetRes(const std::string &id) {
static bool nested_called = false;
if (nested_called) {
return;
}
nested_called = true;
#ifdef ENABLE_GE
FinalizeBackend();
#else
@ -425,6 +432,7 @@ void ExecutorPy::DelNetRes(const std::string &id) {
}
#endif
}
nested_called = false;
}
void ExecutorPy::ClearRes() {

View File

@ -58,7 +58,7 @@ void CalcNodeRefCount(const FuncGraphPtr &graph, std::map<AnfNodePtr, size_t> *n
queue.push(graph->get_return());
std::set<AnfNodePtr> visited;
while (!queue.empty()) {
auto &node = queue.front();
auto node = queue.front();
queue.pop();
MS_EXCEPTION_IF_NULL(node);
if (!node->isa<CNode>()) {