Coverity: Resource leak

This commit is contained in:
wmayer
2020-07-19 11:06:04 +02:00
parent 12670655a9
commit 0b45b11344
4 changed files with 18 additions and 10 deletions

View File

@@ -591,9 +591,9 @@ App::DocumentObject* FemVTKTools::readResult(const char* filename, App::Document
}
App::DocumentObject* mesh = pcDoc->addObject("Fem::FemMeshObject", "ResultMesh");
FemMesh* fmesh = new FemMesh(); // PropertyFemMesh instance is responsible to release FemMesh ??
importVTKMesh(dataset, fmesh);
static_cast<PropertyFemMesh*>(mesh->getPropertyByName("FemMesh"))->setValue(*fmesh);
std::unique_ptr<FemMesh> fmesh(new FemMesh());
importVTKMesh(dataset, fmesh.get());
static_cast<PropertyFemMesh*>(mesh->getPropertyByName("FemMesh"))->setValuePtr(fmesh.release());
static_cast<App::PropertyLink*>(result->getPropertyByName("Mesh"))->setValue(mesh);
// PropertyLink is the property type to store DocumentObject pointer