[IE][Tests]: Fixes dangling reference access in nGraph function comparator (#2105)

Usage reference to front of the queue after pop is UB

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
This commit is contained in:
Gladilov, Gleb 2020-09-09 13:22:29 +03:00 committed by GitHub
parent 685e8f8e7e
commit d43c9cfa0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,9 +211,8 @@ void CompareFunctions(const Function& actual, const Function& expected) {
std::queue<ComparingNodesPair> nodes;
nodes.emplace(actualResult, expectedResult);
while (!nodes.empty()) {
const auto& checkingNodes = nodes.front();
const auto& actualNode = checkingNodes.first;
const auto& expectedNode = checkingNodes.second;
const auto actualNode = nodes.front().first;
const auto expectedNode = nodes.front().second;
nodes.pop();
CompareNodes(*actualNode, *expectedNode);