From 9d002916f47bff979d965189381c68116b81391a Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 20 Mar 2012 18:41:10 +0100 Subject: [PATCH] Fix line number displayed on leakNoVarr error --- lib/checkmemoryleak.cpp | 2 +- test/testmemleak.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 711a44386..11b98cd23 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -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()); } } } diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 498444b9b..8a9700c6b 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -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;