Memory leaks: small fixes. add checking of 'g_fopen'. don't let 'fclose' calls be interpreted as 'callfunc'
This commit is contained in:
parent
495dfde32c
commit
0c6352a826
|
@ -44,7 +44,7 @@ CheckMemoryLeakStructMember instance3;
|
|||
static const char * const call_func_white_list[] =
|
||||
{
|
||||
"asctime", "asctime_r", "asprintf", "atof", "atoi", "atol", "clearerr"
|
||||
, "ctime", "ctime_r", "delete", "fchmod", "fcntl"
|
||||
, "ctime", "ctime_r", "delete", "fchmod", "fclose", "fcntl"
|
||||
, "fdatasync", "feof", "ferror", "fflush", "fgetc", "fgetpos", "fgets"
|
||||
, "flock", "for", "fprintf", "fputc", "fputs", "fread", "free", "fscanf", "fseek"
|
||||
, "fseeko", "fsetpos", "fstat", "fsync", "ftell", "ftello", "ftruncate"
|
||||
|
@ -148,7 +148,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
|
|||
Token::Match(tok2, "new ( nothrow ) %type% ["))
|
||||
return NewArray;
|
||||
|
||||
if (Token::Match(tok2, "fopen|tmpfile ("))
|
||||
if (Token::Match(tok2, "fopen|tmpfile|g_fopen ("))
|
||||
return File;
|
||||
|
||||
if (Token::Match(tok2, "open|openat|creat|mkstemp|mkostemp ("))
|
||||
|
|
|
@ -452,6 +452,7 @@ private:
|
|||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] (s);", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(fclose(p));", "p"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(close(p));", "p"));
|
||||
ASSERT_EQUALS(";;;;", getcode("FILE *f1; FILE *f2; fclose(f1);", "f2"));
|
||||
|
||||
// if..
|
||||
ASSERT_EQUALS(";;if{}", getcode("char *s; if (a) { }", "s"));
|
||||
|
|
Loading…
Reference in New Issue