Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Dec 11, 2023
1 parent 38cb34c commit b7b3c82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/checkleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,7 @@ void CheckLeakAutoVar::changeAllocStatus(VarInfo &varInfo, const VarInfo::AllocI
void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpeningPar, VarInfo &varInfo, const VarInfo::AllocInfo& allocation, const Library::AllocFunc* af)
{
// Ignore function call?
if (mSettings->library.isLeakIgnore(mSettings->library.getFunctionName(tokName)))
return;
const bool isLeakIgnore = mSettings->library.isLeakIgnore(mSettings->library.getFunctionName(tokName));
if (mSettings->library.getReallocFuncInfo(tokName))
return;

Expand Down Expand Up @@ -993,6 +992,8 @@ void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpenin
varAlloc.allocTok = arg;
}
}
else if (isLeakIgnore)
checkTokenInsideExpression(arg, varInfo);
else
changeAllocStatus(varInfo, dealloc.type == 0 ? allocation : dealloc, tokName, arg);
}
Expand Down
5 changes: 2 additions & 3 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,8 @@ class TestLeakAutoVar : public TestFixture {
" free(p);\n"
" strcpy(p, q);\n"
"}\n", false, &s);
TODO_ASSERT_EQUALS("[test.c:3]: (error) Dereferencing 'p' after it is deallocated / released\n",
"",
errout.str());
ASSERT_EQUALS("[test.c:3]: (error) Dereferencing 'p' after it is deallocated / released\n",
errout.str());

check("void f() {\n"
" int *p = (int*)malloc(4);\n"
Expand Down

0 comments on commit b7b3c82

Please sign in to comment.