Coverity: fix high impact issues

This commit is contained in:
wmayer 2016-08-17 15:33:04 +02:00
parent 9b013f7254
commit d98337b5f2
6 changed files with 12 additions and 9 deletions

View File

@ -138,8 +138,12 @@ int main( int argc, char ** argv )
// Destruction phase =========================================================== // Destruction phase ===========================================================
Console().Log("FreeCAD terminating...\n"); Console().Log("FreeCAD terminating...\n");
try {
// close open documents // close open documents
App::GetApplication().closeAllDocuments(); App::GetApplication().closeAllDocuments();
}
catch(...) {
}
// cleans up // cleans up
Application::destruct(); Application::destruct();

View File

@ -118,6 +118,7 @@ extern "C"
Dl_info info; Dl_info info;
int ret = dladdr((void*)initFreeCAD, &info); int ret = dladdr((void*)initFreeCAD, &info);
if ((ret == 0) || (!info.dli_fname)) { if ((ret == 0) || (!info.dli_fname)) {
free(argv);
PyErr_SetString(PyExc_ImportError, "Cannot get path of the FreeCAD module!"); PyErr_SetString(PyExc_ImportError, "Cannot get path of the FreeCAD module!");
return; return;
} }

View File

@ -180,7 +180,7 @@ App::DocumentObjectExecReturn *FeatureViewSpreadsheet::execute(void)
celltext = field.str(); celltext = field.str();
} }
// get colors, style, alignment and span // get colors, style, alignment and span
int alignment; int alignment = 0;
std::string bcolor = "none"; std::string bcolor = "none";
std::string fcolor = "#" + hr.str() + hg.str() + hb.str(); std::string fcolor = "#" + hr.str() + hg.str() + hb.str();
std::string textstyle = ""; std::string textstyle = "";

View File

@ -140,8 +140,7 @@ private:
FemMeshObject *pcFeature = static_cast<FemMeshObject *> FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str()); pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get()); pcFeature->FemMesh.setValuePtr(mesh.release());
(void)mesh.release();
pcFeature->purgeTouched(); pcFeature->purgeTouched();
return Py::None(); return Py::None();
@ -175,8 +174,7 @@ private:
FemMeshObject *pcFeature = static_cast<FemMeshObject *> FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str())); (pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str()); pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get()); pcFeature->FemMesh.setValuePtr(mesh.release());
(void)mesh.release();
pcFeature->purgeTouched(); pcFeature->purgeTouched();
} }
catch(Base::Exception& e) { catch(Base::Exception& e) {

View File

@ -56,7 +56,7 @@ PROPERTY_SOURCE(PartDesignGui::ViewProviderPrimitive,PartDesignGui::ViewProvider
ViewProviderPrimitive::ViewProviderPrimitive() ViewProviderPrimitive::ViewProviderPrimitive()
{ {
previewFaceSet = 0;
} }
ViewProviderPrimitive::~ViewProviderPrimitive() ViewProviderPrimitive::~ViewProviderPrimitive()

View File

@ -2698,7 +2698,7 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue)
// Tracks all constraint IDs that are combined into this icon // Tracks all constraint IDs that are combined into this icon
QString idString; QString idString;
int lastVPad; int lastVPad = 0;
QStringList labels; QStringList labels;
std::vector<int> ids; std::vector<int> ids;