Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8
, /lib/symboldatabase.h:288)
This commit is contained in:
parent
2ac2dcf392
commit
3f30753122
|
@ -202,7 +202,7 @@ void CheckAutoVariables::autoVariables()
|
|||
errorInvalidDeallocation(tok);
|
||||
} else if (Token::Match(tok, "free ( & %var% ) ;") || Token::Match(tok, "delete [| ]| (| & %var% !![")) {
|
||||
tok = Token::findmatch(tok->next(), "%var%");
|
||||
if (tok->variable()->isLocal())
|
||||
if (tok && tok->variable() && tok->variable()->isLocal())
|
||||
errorInvalidDeallocation(tok);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ private:
|
|||
TEST_CASE(testautovar10); // ticket #2930 - void f(char *p) { p = '\0'; }
|
||||
TEST_CASE(testautovar11); // ticket #4641 - fp, assign local struct member address to function parameter
|
||||
TEST_CASE(testautovar12); // ticket #5024 - crash
|
||||
TEST_CASE(testautovar13); // ticket #5537 - crash
|
||||
TEST_CASE(testautovar_array1);
|
||||
TEST_CASE(testautovar_array2);
|
||||
TEST_CASE(testautovar_return1);
|
||||
|
@ -359,6 +360,16 @@ private:
|
|||
"UNKNOWN_MACRO_EXPANDING_TO_SIGNATURE { custom_type a(var); }");
|
||||
}
|
||||
|
||||
void testautovar13() { // Ticket #5537
|
||||
check("class FileManager {\n"
|
||||
" FileManager() : UniqueRealDirs(*new UniqueDirContainer())\n"
|
||||
" {}\n"
|
||||
" ~FileManager() {\n"
|
||||
" delete &UniqueRealDirs;\n"
|
||||
" }\n"
|
||||
"};\n");
|
||||
}
|
||||
|
||||
void testautovar_array1() {
|
||||
check("void func1(int* arr[2])\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue