From: kronbichler Date: Fri, 24 Jan 2014 16:52:51 +0000 (+0000) Subject: Fix use of freed memory: Change when to reset the vector X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0f89312179085cd8d911d951d493f43ceefe169;p=dealii-svn.git Fix use of freed memory: Change when to reset the vector git-svn-id: https://svn.dealii.org/trunk@32300 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index 9e7896532b..951d660755 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -497,15 +497,14 @@ namespace TrilinosWrappers void Vector::reinit (const Epetra_Map ¶llel_partitioner, const dealii::Vector &v) { - if (vector.get() != 0 && vector->Map().SameAs(parallel_partitioner)) + if (vector.get() == 0 || vector->Map().SameAs(parallel_partitioner) == false) vector.reset (new Epetra_FEVector(parallel_partitioner)); has_ghosts = vector->Map().UniqueGIDs()==false; const int size = parallel_partitioner.NumMyElements(); - // Need to copy out values, since the - // deal.II might not use doubles, so + // Need to copy out values, since the deal.II might not use doubles, so // that a direct access is not possible. for (int i=0; i