Fixed #2112 (Crash scanning qtcreator sources)
This commit is contained in:
parent
6a66d32871
commit
eba827bc4b
|
@ -1282,7 +1282,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
|
|
||||||
if (tok2->str() == "(")
|
if (tok2->str() == "(")
|
||||||
f.push(tok2->previous());
|
f.push(tok2->previous());
|
||||||
else if (tok2->str() == ")")
|
else if (!f.empty() && tok2->str() == ")")
|
||||||
f.pop();
|
f.pop();
|
||||||
|
|
||||||
if (tok2->varId() == varid)
|
if (tok2->varId() == varid)
|
||||||
|
|
|
@ -569,6 +569,13 @@ private:
|
||||||
|
|
||||||
// call memcpy in class function..
|
// call memcpy in class function..
|
||||||
ASSERT_EQUALS(";;alloc;;", getcode("char *s; s = new char[10]; memcpy(s,a);", "s", true));
|
ASSERT_EQUALS(";;alloc;;", getcode("char *s; s = new char[10]; memcpy(s,a);", "s", true));
|
||||||
|
|
||||||
|
// #2112 - Segmentation fault in the getcode function
|
||||||
|
getcode("page *one = foo();\n"
|
||||||
|
"ASSERT(one, return 0)\n"
|
||||||
|
"const int two = rand();\n"
|
||||||
|
"return 0;\n"
|
||||||
|
"}", "one");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue