Fix line number displayed on leakNoVarr error

This commit is contained in:
Pierre Schweitzer 2012-03-20 18:41:10 +01:00
parent cb2a754983
commit 9d002916f4
2 changed files with 3 additions and 3 deletions

View File

@ -2881,7 +2881,7 @@ void CheckMemoryLeakNoVar::check()
// Handle the case where the user is calling an allocation function // 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. // 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) else if (Token::Match(tok2, "[;{}] %var% (") && getAllocationType(tok2->next(), 0) != No)
missingAssignementLeak(tok2, tok2->next()->str()); missingAssignementLeak(tok2->next(), tok2->next()->str());
} }
} }
} }

View File

@ -5250,7 +5250,7 @@ private:
"{\n" "{\n"
" malloc(10);\n" " malloc(10);\n"
"}\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" check("void *f()\n"
"{\n" "{\n"
@ -5260,7 +5260,7 @@ private:
"{\n" "{\n"
" f();\n" " f();\n"
"}\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; static TestMemleakNoVar testMemleakNoVar;