Memory leak : added standard functions that are safe and doesn't need to be checked
This commit is contained in:
parent
02d6e367e7
commit
ff3a1714f2
|
@ -189,9 +189,26 @@ CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetDeallocationType( const
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
const char * CheckMemoryLeakClass::call_func( const TOKEN *tok, std::list<const TOKEN *> callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype )
|
const char * CheckMemoryLeakClass::call_func( const TOKEN *tok, std::list<const TOKEN *> callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype )
|
||||||
{
|
{
|
||||||
if (TOKEN::Match(tok,"if") || TOKEN::Match(tok,"for") || TOKEN::Match(tok,"while"))
|
// Keywords that are not function calls..
|
||||||
|
if (TOKEN::Match(tok,"if|for|while"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// String functions that are not allocating nor deallocating memory..
|
||||||
|
if (TOKEN::Match(tok, "strcpy|strncpy|strcat|strncat|strcmp|strncmp|strcasecmp|stricmp|sprintf|strchr|strrchr|strstr"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Memory functions that are not allocating nor deallocating memory..
|
||||||
|
if (TOKEN::Match(tok, "memset|memcpy|memmove|memchr"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// I/O functions that are not allocating nor deallocating memory..
|
||||||
|
if (TOKEN::Match(tok, "fgets|fgetc|fputs|fputc|printf"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Convert functions that are not allocating nor deallocating memory..
|
||||||
|
if (TOKEN::Match(tok, "atoi|atof|atol|strtol|strtoul|strtod"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (GetAllocationType(tok)!=No || GetReallocationType(tok)!=No || GetDeallocationType(tok,varnames)!=No)
|
if (GetAllocationType(tok)!=No || GetReallocationType(tok)!=No || GetDeallocationType(tok,varnames)!=No)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue