diff --git a/hipamd/src/hip_graph_internal.cpp b/hipamd/src/hip_graph_internal.cpp index ad1614d772..c90a8cd75e 100644 --- a/hipamd/src/hip_graph_internal.cpp +++ b/hipamd/src/hip_graph_internal.cpp @@ -357,7 +357,9 @@ Graph* Graph::clone(std::unordered_map& clonedNodes) const { newGraph->graphUserObj_.insert(userObj); } // Clone the root nodes to the new graph - memcpy(&newGraph->roots_[0], &roots_[0], sizeof(Node) * roots_.size()); + if (roots_.size() > 0) { + memcpy(&newGraph->roots_[0], &roots_[0], sizeof(Node) * roots_.size()); + } return newGraph; }