src/checkmemoryleak.cpp: added fchmod() function to white list.

This commit is contained in:
Slava Semushin 2009-07-18 23:48:48 +07:00
parent d3490abd64
commit 2ba0897ecb
2 changed files with 3 additions and 2 deletions

View File

@ -435,7 +435,7 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<co
// I/O functions that are not allocating nor deallocating memory..
if (Token::Match(tok, "read|readv|pread|readahead|write|writev|pwrite|lseek") ||
Token::Match(tok, "ioctl|fcntl|flock|lockf|ftruncate|fsync|fdatasync") ||
Token::Match(tok, "ioctl|fchmod|fcntl|flock|lockf|ftruncate|fsync|fdatasync") ||
Token::Match(tok, "fstat|sync_file_range|posix_fallocate|posix_fadvise"))
return 0;

View File

@ -2316,8 +2316,9 @@ private:
" lockf(fd, cmd, len);\n"
" ftruncate(fd, len);\n"
" fstat(fd, buf);\n"
" fchmod(fd, mode);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:23]: (error) Resource leak: fd\n", errout.str());
ASSERT_EQUALS("[test.cpp:24]: (error) Resource leak: fd\n", errout.str());
}
void opendir_function()