Examples of errors detected by the V630 diagnostic
V630. The 'malloc' function is used to allocate memory for an array of objects that are classes containing constructors/destructors.
Blender
V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors. FitCurve.cpp 129
typedef struct Point2Struct { double coordinates[2]; Point2Struct() { .... } .... } Point2; typedef Point2 Vector2; using BezierCurve = Vector2 *; static BezierCurve GenerateBezier(Vector2 *d, int first, int last, double *uPrime, Vector2 tHat1, Vector2 tHat2) { .... BezierCurve bezCurve; /* RETURN bezier curve control points. */ .... bezCurve = (Vector2 *)malloc(4 * sizeof(Vector2)); // <= .... if (alpha_l < 1.0e-6 || alpha_r < 1.0e-6) { .... bezCurve[0] = d[first]; bezCurve[3] = d[last]; .... } .... } MuseScore
V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors and destructors. IntervalTree.h 70
IntervalTree<T,K>(const intervalTree& other) { center = other.center; intervals = other.intervals; if (other.left) { left = (intervalTree*) malloc(sizeof(intervalTree)); // <= *left = *other.left; } else { left = NULL; } if (other.right) { right = new intervalTree(); *right = *other.right; } else { right = NULL; } } IntervalTree<T,K>& operator=(const intervalTree& other) { center = other.center; intervals = other.intervals; if (other.left) { left = new intervalTree(); // <= *left = *other.left; } else { left = NULL; } if (other.right) { right = new intervalTree(); // <= *right = *other.right; } else { right = NULL; } return *this; } Newton Game Dynamics
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. dgSkeletonContainer.cpp 1342
#define alloca _alloca .... #define dAlloca(type,size) (type*) alloca ((size) * sizeof (type)) .... dgSpatialMatrix::dgSpatialMatrix(); dgSpatialMatrix::dgSpatialMatrix(dgFloat32 val); .... dgSpatialMatrix* const jointMassArray = dgAlloca(dgSpatialMatrix, m_nodeCount); Newton Game Dynamics
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. dgSkeletonContainer.cpp 1341
#define alloca _alloca .... #define dAlloca(type,size) (type*) alloca ((size) * sizeof (type)) .... dgSpatialMatrix::dgSpatialMatrix(); dgSpatialMatrix::dgSpatialMatrix(dgFloat32 val); .... dgSpatialMatrix* const bodyMassArray = dgAlloca(dgSpatialMatrix, m_nodeCount); EFL Core Libraries
V630 The 'calloc' function is used to allocate memory for an array of objects which are classes containing constructors. ephysics_world.cpp 299
class btVector3 { public: .... btScalar m_floats[4]; inline btVector3() { } .... }; typedef struct _Simulation_Msg Simulation_Msg; struct _Simulation_Msg { EPhysics_Body *body_0; EPhysics_Body *body_1; btVector3 pos_a; btVector3 pos_b; Eina_Bool tick:1; }; static void _ephysics_world_tick_dispatch(EPhysics_World *world) { Simulation_Msg *msg; if (!world->ticked) return; world->ticked = EINA_FALSE; world->pending_ticks++; msg = (Simulation_Msg *) calloc(1, sizeof(Simulation_Msg)); msg->tick = EINA_TRUE; ecore_thread_feedback(world->cur_th, msg); } Similar errors can be found in some other places:
- V630 The 'calloc' function is used to allocate memory for an array of objects which are classes containing constructors. ephysics_world.cpp 471
CryEngine V
V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. command_buffer.cpp 62
void CBuffer::Execute() { .... QuatT * pJointsTemp = static_cast<QuatT*>( alloca(m_state.m_jointCount * sizeof(QuatT))); .... } Similar errors can be found in some other places:
- V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. command_buffer.cpp 67
- V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. posematching.cpp 144
- V630 The '_alloca' function is used to allocate memory for an array of objects which are classes containing constructors. characterinstance.cpp 280
- And 4 additional diagnostic messages.
Computational Network Toolkit
V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors. latticeforwardbackward.cpp 912
struct aligninfo // phonetic alignment { unsigned int unit : 19; // triphone index unsigned int frames : 11; // duration in frames unsigned int unused : 1; // (for future use) unsigned int last : 1; // set for last entry aligninfo(size_t punit, size_t pframes) : unit((unsigned int) punit), frames((unsigned int) pframes), unused(0), last(0) { checkoverflow(unit, punit, "aligninfo::unit"); checkoverflow(frames, pframes, "aligninfo::frames"); } aligninfo() // [v-hansu] initialize to impossible values { #ifdef INITIAL_STRANGE unit = unsigned int(-1); frames = unsigned int(-1); unused = unsigned int(-1); last = unsigned int(-1); #endif } template <class IDMAP> void updateunit(const IDMAP& idmap /*[unit] -> new unit*/) { const size_t mappedunit = idmap[unit]; unit = (unsigned int) mappedunit; checkoverflow(unit, mappedunit, "aligninfo::unit"); } }; void lattice::forwardbackwardalign() { .... aligninfo *refinfo; unsigned short *refalign; refinfo = (aligninfo *) malloc(sizeof(aligninfo) * 1); // <= refalign = (unsigned short *) malloc(sizeof(....) * framenum); array_ref<aligninfo> refunits(refinfo, 1); array_ref<unsigned short> refedgealignmentsj(....); .... } Haiku Operation System
V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors. PDFWriter.cpp 117
BRect::BRect(); BRect::BRect(const BRect& other); BRect::BRect(float side); BPoint::BPoint(); BPoint::BPoint(float x, float y); BPoint::BPoint(const BPoint& p); status_t PDFWriter::PrintPage(int32 pageNumber, int32 pageCount) { .... pictures = (BPicture **)malloc(pictureCount * sizeof(BPicture *)); picRects = (BRect *)malloc(pictureCount * sizeof(BRect)); // <= picPoints = (BPoint *)malloc(pictureCount * sizeof(BPoint)); // <= picRegion = new BRegion(); .... } Cocos2d-x
V630 The 'malloc' function is used to allocate memory for an array of objects which are classes containing constructors and destructors. ccmotionstreak.cpp 122
Vec2::Vec2() : x(0.0f), y(0.0f) { } Vec2::Vec2(float xx, float yy) : x(xx), y(yy) { } bool MotionStreak::initWithFade(...) { .... _pointVertexes = (Vec2*)malloc(sizeof(Vec2) * _maxPoints); _vertices = (Vec2*)malloc(sizeof(Vec2) * _maxPoints * 2); _texCoords = (Tex2F*)malloc(sizeof(Tex2F) * _maxPoints * 2); .... }