From b7b3c82b02f6dbb5bb4ba134590fb094f1086b46 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 11 Dec 2023 21:46:27 +0100 Subject: [PATCH] Try again --- lib/checkleakautovar.cpp | 5 +++-- test/testleakautovar.cpp | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index f684e7b7ccf..0602bb1f541 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -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; @@ -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); } diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 73be514471c..adf60b1c4ab 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -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"