PVS-StudioWarnings

PVS-Studio warning V630 for Cocos2d-x

Nov 20th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. Vec2::Vec2() : x(0.0f), y(0.0f) { }
  2. Vec2::Vec2(float xx, float yy) : x(xx), y(yy) { }
  3.  
  4. bool MotionStreak::initWithFade(...)
  5. {
  6.   ....
  7.   _pointVertexes = (Vec2*)malloc(sizeof(Vec2) * _maxPoints);
  8.   _vertices = (Vec2*)malloc(sizeof(Vec2) * _maxPoints * 2);
  9.   _texCoords = (Tex2F*)malloc(sizeof(Tex2F) * _maxPoints * 2);
  10.   ....
  11. }
  12.  
  13. This suspicious code was found in Cocos2d-x project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors and destructors. ccmotionstreak.cpp 122
  16.  
  17. 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