CheckLeakAutoVar: fix crash on unknown macro (#5836)
This commit is contained in:
parent
02f474bc19
commit
f9134a69d2
|
@ -1046,10 +1046,10 @@ void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpenin
|
||||||
changeAllocStatus(varInfo, sp_allocation, vtok, vtok);
|
changeAllocStatus(varInfo, sp_allocation, vtok, vtok);
|
||||||
} else {
|
} else {
|
||||||
const Token* const nextArg = funcArg->nextArgument();
|
const Token* const nextArg = funcArg->nextArgument();
|
||||||
do {
|
while (arg && ((nextArg && arg != nextArg) || (!nextArg && arg != tokOpeningPar->link()))) {
|
||||||
checkTokenInsideExpression(arg, varInfo, /*inFuncCall*/ isLeakIgnore);
|
checkTokenInsideExpression(arg, varInfo, /*inFuncCall*/ isLeakIgnore);
|
||||||
arg = arg->next();
|
arg = arg->next();
|
||||||
} while ((nextArg && arg != nextArg) || (!nextArg && arg != tokOpeningPar->link()));
|
}
|
||||||
}
|
}
|
||||||
// TODO: check each token in argument expression (could contain multiple variables)
|
// TODO: check each token in argument expression (could contain multiple variables)
|
||||||
argNr++;
|
argNr++;
|
||||||
|
|
|
@ -981,6 +981,11 @@ private:
|
||||||
ASSERT_EQUALS("[test.c:4]: (error) Dereferencing 'p' after it is deallocated / released\n"
|
ASSERT_EQUALS("[test.c:4]: (error) Dereferencing 'p' after it is deallocated / released\n"
|
||||||
"[test.c:7] -> [test.c:8]: (error) Returning/dereferencing 'p' after it is deallocated / released\n",
|
"[test.c:7] -> [test.c:8]: (error) Returning/dereferencing 'p' after it is deallocated / released\n",
|
||||||
errout.str());
|
errout.str());
|
||||||
|
|
||||||
|
check("void f() {\n"
|
||||||
|
" FOREACH(callables, ());\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.c:2]: (information) --check-library: Function FOREACH() should have <noreturn> configuration\n", errout.str()); // don't crash
|
||||||
}
|
}
|
||||||
|
|
||||||
void doublefree1() { // #3895
|
void doublefree1() { // #3895
|
||||||
|
|
Loading…
Reference in New Issue