PVS-StudioWarnings

PVS-Studio warning V595 for Cocos2d-x

Nov 20th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. template<>
  2. inline bool BundleReader::readArray<std::string>(
  3.   unsigned int *length, std::vector<std::string> *values)
  4. {
  5.   ....
  6.   values->clear();             //<==
  7.   if (*length > 0 && values)   //<==
  8.   {
  9.     for (int i = 0; i < (int)*length; ++i)
  10.     {
  11.       values->push_back(readString());
  12.     }
  13.   }
  14.   return true;
  15. }
  16.  
  17. This suspicious code was found in Cocos2d-x project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V595 The 'values' pointer was utilized before it was verified against nullptr. Check lines: 188, 189. ccbundlereader.h 188
  20.  
  21. 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