parent
3a186b5bff
commit
b3fef7957a
|
@ -919,7 +919,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok->previous(), "%op%|;|{|}|) ::| %name%") || (Token::Match(tok->previous(), "( ::| %name%") && (!rettail || rettail->str() != "loop"))) {
|
if (Token::Match(tok->previous(), "%op%|;|,|{|}|) ::| %name%") || (Token::Match(tok->previous(), "( ::| %name%") && (!rettail || rettail->str() != "loop"))) {
|
||||||
if (tok->str() == "::")
|
if (tok->str() == "::")
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
|
|
@ -347,6 +347,7 @@ private:
|
||||||
TEST_CASE(creat_function);
|
TEST_CASE(creat_function);
|
||||||
TEST_CASE(close_function);
|
TEST_CASE(close_function);
|
||||||
TEST_CASE(fd_functions);
|
TEST_CASE(fd_functions);
|
||||||
|
TEST_CASE(fclose_comma); // #7525
|
||||||
|
|
||||||
TEST_CASE(pointer_to_pointer);
|
TEST_CASE(pointer_to_pointer);
|
||||||
TEST_CASE(dealloc_and_alloc_in_func);
|
TEST_CASE(dealloc_and_alloc_in_func);
|
||||||
|
@ -3816,6 +3817,16 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fclose_comma() {
|
||||||
|
check("int main(void) {\n"
|
||||||
|
" const char *const outfile = \"out.txt\";\n"
|
||||||
|
" FILE *f;\n"
|
||||||
|
" f = fopen(outfile, \"w\");\n"
|
||||||
|
" fprintf(f, \"foo\\n\"), fclose(f);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void pointer_to_pointer() {
|
void pointer_to_pointer() {
|
||||||
check("void f(char **data)\n"
|
check("void f(char **data)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue