diff --git a/dumux/implicit/common/implicitproblem.hh b/dumux/implicit/common/implicitproblem.hh index 60fbfad75be9b7c297d2de9d48f46fcd0fb62cca..97979e658c53a20248539dcc1f8207aac67c5c7f 100644 --- a/dumux/implicit/common/implicitproblem.hh +++ b/dumux/implicit/common/implicitproblem.hh @@ -99,6 +99,7 @@ public: , timeManager_(&timeManager) , newtonMethod_(asImp_()) , newtonCtl_(asImp_()) + , resultWriter_(0) { // calculate the bounding box of the local partition of the grid view VertexIterator vIt = gridView.template begin<dim>(); @@ -119,13 +120,12 @@ public: // set a default name for the problem simName_ = "sim"; - - resultWriter_ = NULL; } ~ImplicitProblem() { - delete resultWriter_; + if (resultWriter_) + delete resultWriter_; }; diff --git a/dumux/implicit/mpnc/mpncmodel.hh b/dumux/implicit/mpnc/mpncmodel.hh index e8ba3bb925727da906656ff5f76680c627a61fa2..f61d9d8e14bb95ebd73c6cc0bf91ce768499d1c0 100644 --- a/dumux/implicit/mpnc/mpncmodel.hh +++ b/dumux/implicit/mpnc/mpncmodel.hh @@ -126,8 +126,15 @@ class MPNCModel : public GET_PROP_TYPE(TypeTag, BaseModel) enum {numEq = GET_PROP_VALUE(TypeTag, NumEq)}; public: + MPNCModel() + : vtkWriter_(0) + {} + ~MPNCModel() - { delete vtkWriter_; }; + { + if (vtkWriter_) + delete vtkWriter_; + } void init(Problem &problem) {