PVS-StudioWarnings

PVS-Studio warning V579 for FAR

Nov 18th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. struct TreeItem
  2. {
  3.   int *Last;
  4.   size_t LastCount;
  5.   ...
  6.   void Clear()
  7.   {
  8.     strName.Clear();
  9.     memset(Last,0,sizeof(Last));
  10.     Depth=0;
  11.   }
  12. };
  13.  
  14. This is what should have been written here: memset(Last,0,LastCount*sizeof(int));
  15.  
  16. This suspicious code was found in FAR project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V579 The memset function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. far treelist.hpp 66
  19.  
  20. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment