File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,7 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
996996 const Token* tok2 = tok->next ()->astParent ();
997997 while (tok2 && tok2->isCast ())
998998 tok2 = tok2->astParent ();
999- if (tok2 && tok2-> isAssignmentOp ( ))
999+ if (Token::Match ( tok2, " %assign%|return " ))
10001000 continue ;
10011001
10021002 const std::string& functionName = tok->str ();
Original file line number Diff line number Diff line change @@ -2173,6 +2173,11 @@ class TestMemleakNoVar : public TestFixture {
21732173 " return ret;\n "
21742174 " }" );
21752175 ASSERT_EQUALS (" " , errout.str ());
2176+
2177+ check (" char *x() {\n "
2178+ " return strcpy(malloc(10), \" abc\" );\n "
2179+ " }" );
2180+ ASSERT_EQUALS (" " , errout.str ());
21762181
21772182 check (" void x() {\n "
21782183 " free(malloc(10));\n "
You can’t perform that action at this time.
0 commit comments