Fixed Coverity reported issues.
CID 11389: Resource leak in object (CTOR_DTOR_LEAK) Allocating memory by calling "new bsp::VBSPData". Assigning: "this->bsp_data" = "new bsp::VBSPData". The constructor allocates field "bsp_data" of "struct bsp::VBSPReader" but the destructor and whatever functions it calls do not free it.
This commit is contained in:
@@ -162,7 +162,7 @@ struct DisplacedVertex
|
||||
};
|
||||
|
||||
|
||||
class VBSPData
|
||||
class VBSPData : public osg::Referenced
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -211,10 +211,11 @@ protected:
|
||||
typedef std::vector< osg::ref_ptr<osg::StateSet> > StateSetList;
|
||||
StateSetList state_set_list;
|
||||
|
||||
virtual ~VBSPData();
|
||||
|
||||
public:
|
||||
|
||||
VBSPData();
|
||||
virtual ~VBSPData();
|
||||
|
||||
void addEntity(std::string & newEntity);
|
||||
const int getNumEntities() const;
|
||||
|
||||
@@ -1055,7 +1055,7 @@ void VBSPReader::createScene()
|
||||
{
|
||||
// Get the entity
|
||||
entityText = bsp_data->getEntity(i);
|
||||
currentEntity = new VBSPEntity(entityText, bsp_data);
|
||||
currentEntity = new VBSPEntity(entityText, bsp_data.get());
|
||||
|
||||
// See if the entity is visible
|
||||
if (currentEntity->isVisible())
|
||||
|
||||
@@ -233,7 +233,7 @@ protected:
|
||||
|
||||
std::string map_name;
|
||||
|
||||
VBSPData * bsp_data;
|
||||
osg::ref_ptr<VBSPData> bsp_data;
|
||||
|
||||
osg::ref_ptr<osg::Node> root_node;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user