mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
fix: memory leak from missing deletes of raw heap allocations; big issue within create_shape() python lib
This commit is contained in:
committed by
Thomas Krijnen
parent
4594f596c2
commit
c6e3ac4155
@@ -206,6 +206,8 @@ ifcopenshell::geometry::kernels::AbstractKernel* ifcopenshell::geometry::kernels
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (kernels.size() != n + 1) {
|
if (kernels.size() != n + 1) {
|
||||||
|
for (auto k : kernels)
|
||||||
|
delete k;
|
||||||
throw IfcParse::IfcException("Invalid hybrid kernel " + geometry_library);
|
throw IfcParse::IfcException("Invalid hybrid kernel " + geometry_library);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,16 @@ ifcopenshell::geometry::Converter::Converter(const std::string& geometry_library
|
|||||||
settings_ = mapping_->settings();
|
settings_ = mapping_->settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ifcopenshell::geometry::Converter::~Converter()
|
||||||
|
{
|
||||||
|
if (kernel_ != nullptr) {
|
||||||
|
delete kernel_;
|
||||||
|
}
|
||||||
|
if (mapping_ != nullptr) {
|
||||||
|
delete mapping_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void substitute_with_box_based_on_density(IfcGeom::ConversionResults& items, double& density) {
|
void substitute_with_box_based_on_density(IfcGeom::ConversionResults& items, double& density) {
|
||||||
int nv = 0;
|
int nv = 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace ifcopenshell { namespace geometry {
|
|||||||
|
|
||||||
Converter(const std::string& geometry_library, IfcParse::IfcFile* file, ifcopenshell::geometry::Settings& settings);
|
Converter(const std::string& geometry_library, IfcParse::IfcFile* file, ifcopenshell::geometry::Settings& settings);
|
||||||
|
|
||||||
~Converter() {}
|
~Converter();
|
||||||
|
|
||||||
ifcopenshell::geometry::abstract_mapping* mapping() const { return mapping_; }
|
ifcopenshell::geometry::abstract_mapping* mapping() const { return mapping_; }
|
||||||
|
|
||||||
|
|||||||
@@ -978,6 +978,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
|
|||||||
if (b.Extent() == 0) {
|
if (b.Extent() == 0) {
|
||||||
Logger::Warning("No other operands remaining, using first operand");
|
Logger::Warning("No other operands remaining, using first operand");
|
||||||
result = a;
|
result = a;
|
||||||
|
delete builder;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,6 +1131,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
|
|||||||
} else {
|
} else {
|
||||||
Logger::Notice("Processed fully in 2D");
|
Logger::Notice("Processed fully in 2D");
|
||||||
result = mp.Shape();
|
result = mp.Shape();
|
||||||
|
delete builder;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user