Fixed #5144 (FP old memleak - tree structure)
This commit is contained in:
parent
1b21767954
commit
85ae3adeb2
|
@ -386,6 +386,9 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::functionReturnType(const Function* f
|
|||
if (Token::Match(tok, "[(,] & %varid% [.,)]", varid)) {
|
||||
return No;
|
||||
}
|
||||
if (Token::Match(tok, "[;{}] %varid% .", varid)) {
|
||||
return No;
|
||||
}
|
||||
if (allocType == No && tok->str() == "return")
|
||||
return No;
|
||||
}
|
||||
|
|
|
@ -2575,6 +2575,20 @@ private:
|
|||
" char* s = data();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5144
|
||||
check("C* BuildC( C *previous ) {\n"
|
||||
" C *result = malloc(100);\n"
|
||||
" result->previous = previous;\n"
|
||||
" return result;\n"
|
||||
"}\n"
|
||||
"C *ParseC( ) {\n"
|
||||
" C *expr1 = NULL;\n"
|
||||
" while( something() )\n"
|
||||
" expr1 = BuildC(expr1);\n"
|
||||
" return expr1;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void allocfunc8() {
|
||||
|
|
Loading…
Reference in New Issue