Memory leak: Minor fix to prevent hang

This commit is contained in:
Daniel Marjamäki 2008-11-17 20:29:50 +00:00
parent 745d885808
commit d6075a2125
1 changed files with 9 additions and 3 deletions

View File

@ -177,9 +177,15 @@ const char * CheckMemoryLeakClass::call_func( const TOKEN *tok, std::list<const
if (GetAllocationType(tok)!=No || GetDeallocationType(tok,varnames)!=No) if (GetAllocationType(tok)!=No || GetDeallocationType(tok,varnames)!=No)
return 0; return 0;
if ( callstack.size() > 10 )
return 0;
const char *funcname = tok->str; const char *funcname = tok->str;
if ( std::find(callstack.begin(), callstack.end(), tok) != callstack.end() ) for ( std::list<const TOKEN *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it )
return "use"; {
if ( std::string(funcname) == (*it)->str )
return 0;
}
callstack.push_back(tok); callstack.push_back(tok);
int par = 1; int par = 1;