Fixes initialization issues in IfcEntityInstanceData constructors

attributes_ was allocated as an array of Argument pointers but the pointers were uninitialized in the construction. Initialization was done in the HeaderEntity class constructor.

offset_in_file_ is uninitialized in one constructor
This commit is contained in:
Rick Brice
2021-04-17 19:33:06 -07:00
committed by Thomas Krijnen
parent 6c8858e51d
commit 75040b6ffb
2 changed files with 5 additions and 14 deletions
+5 -9
View File
@@ -48,17 +48,13 @@ public:
: file(file_), id_(id), type_(type), attributes_(0), offset_in_file_(offset_in_file)
{}
IfcEntityInstanceData(IfcParse::IfcFile* file_, size_t size)
: file(file_), id_(0), type_(0), attributes_(new Argument*[size]), offset_in_file_(0)
IfcEntityInstanceData(IfcParse::IfcFile* file_, size_t size)
: file(file_), id_(0), type_(0), attributes_(new Argument*[size] {0}), offset_in_file_(0)
{}
IfcEntityInstanceData(const IfcParse::declaration* type)
: file(0), id_(0), type_(type), attributes_(new Argument*[getArgumentCount()])
{
for (size_t i = 0; i < getArgumentCount(); ++i) {
attributes_[i] = 0;
}
}
IfcEntityInstanceData(const IfcParse::declaration* type)
: file(0), id_(0), type_(type), attributes_(new Argument*[getArgumentCount()]{ 0 }), offset_in_file_(0)
{}
void load() const;
-5
View File
@@ -43,11 +43,6 @@ HeaderEntity::HeaderEntity(const char * const datatype, size_t size, IfcFile* fi
if (file) {
offset_in_file_ = file->stream->Tell();
load();
} else {
// attributes_ = new Argument*[size];
for (size_t i = 0; i < size; ++i) {
attributes_[i] = 0;
}
}
}