From 77e0d9cca7c44b9b3723cfb03fe77cb82c5c8eee Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 21 Mar 2018 17:29:37 +0100 Subject: [PATCH] Freeing of lazily loaded inst attrs --- src/ifcparse/IfcParse.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 1f2030535b..831bbef2ef 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -969,10 +969,12 @@ std::string IfcEntityInstanceData::toString(bool upper) const { } IfcEntityInstanceData::~IfcEntityInstanceData() { - for (size_t i = 0; i < getArgumentCount(); ++i) { - delete attributes_[i]; + if (attributes_ != NULL) { + for (size_t i = 0; i < getArgumentCount(); ++i) { + delete attributes_[i]; + } + delete[] attributes_; } - delete[] attributes_; } unsigned IfcEntityInstanceData::set_id(boost::optional i) {