Fixed 3 Coverity issues.

CID 11697: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _type is not initialized in this constructor nor in any functions that it calls.

CID 11698: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _type is not initialized in this constructor nor in any functions that it calls.

CID 12329: Resource leak (RESOURCE_LEAK)
Calling allocation function "osg::Object::clone(osg::CopyOp const &) const". (The virtual call resolves to "osg::Object * GDALPlugin::DataSetLayer::clone(osg::CopyOp const &) const".) [show details]
Failing to save storage allocated by "this->getVertexArray()->clone(struct osg::CopyOp const(128U))" leaks it.
This commit is contained in:
Robert Osfield 2011-05-24 10:16:12 +00:00
parent da058c0ffa
commit 3357cc0717

View File

@ -1286,7 +1286,8 @@ class AttributeFunctorArrayVisitor : public ArrayVisitor
public:
AttributeFunctorArrayVisitor(Drawable::AttributeFunctor& af):
_af(af) {}
_af(af),
_type(0) {}
virtual ~AttributeFunctorArrayVisitor() {}
@ -1358,7 +1359,8 @@ class ConstAttributeFunctorArrayVisitor : public ConstArrayVisitor
public:
ConstAttributeFunctorArrayVisitor(Drawable::ConstAttributeFunctor& af):
_af(af) {}
_af(af),
_type(0) {}
virtual ~ConstAttributeFunctorArrayVisitor() {}
@ -2456,7 +2458,7 @@ void Geometry::duplicateSharedArrays()
#define DUPLICATE_IF_REQUIRED(A) \
if (get##A() && get##A()->referenceCount()>1) \
{ \
set##A(dynamic_cast<osg::Array*>(get##A()->clone(osg::CopyOp::DEEP_COPY_ARRAYS))); \
set##A(osg::clone(get##A(), osg::CopyOp::DEEP_COPY_ARRAYS)); \
}
DUPLICATE_IF_REQUIRED(VertexArray)
@ -2469,7 +2471,7 @@ void Geometry::duplicateSharedArrays()
{
if (getTexCoordArray(ti) && getTexCoordArray(ti)->referenceCount()>1)
{
setTexCoordArray(ti, dynamic_cast<osg::Array*>(getTexCoordArray(ti)->clone(osg::CopyOp::DEEP_COPY_ARRAYS)));
setTexCoordArray(ti, osg::clone(getTexCoordArray(ti),osg::CopyOp::DEEP_COPY_ARRAYS));
}
}
@ -2478,7 +2480,7 @@ void Geometry::duplicateSharedArrays()
ArrayData& arrayData = _vertexAttribList[vi];
if (arrayData.array.valid() && arrayData.array->referenceCount()>1)
{
arrayData.array = dynamic_cast<osg::Array*>(arrayData.array->clone(osg::CopyOp::DEEP_COPY_ARRAYS));
arrayData.array = osg::clone(arrayData.array.get(), osg::CopyOp::DEEP_COPY_ARRAYS);
}
}
}