Fix line number displayed on leakNoVarr error
This commit is contained in:
parent
cb2a754983
commit
9d002916f4
|
@ -2881,7 +2881,7 @@ void CheckMemoryLeakNoVar::check()
|
|||
// Handle the case where the user is calling an allocation function
|
||||
// and never assigns the returned value to a variable, which will lead to a leak.
|
||||
else if (Token::Match(tok2, "[;{}] %var% (") && getAllocationType(tok2->next(), 0) != No)
|
||||
missingAssignementLeak(tok2, tok2->next()->str());
|
||||
missingAssignementLeak(tok2->next(), tok2->next()->str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5250,7 +5250,7 @@ private:
|
|||
"{\n"
|
||||
" malloc(10);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Return value of allocation function malloc is not used.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function malloc is not used.\n", errout.str());
|
||||
|
||||
check("void *f()\n"
|
||||
"{\n"
|
||||
|
@ -5260,7 +5260,7 @@ private:
|
|||
"{\n"
|
||||
" f();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:6]: (error) Return value of allocation function f is not used.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:7]: (error) Return value of allocation function f is not used.\n", errout.str());
|
||||
}
|
||||
};
|
||||
static TestMemleakNoVar testMemleakNoVar;
|
||||
|
|
Loading…
Reference in New Issue