From: Martin 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-Tag: v8.2.0-rc1~967 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee0520462fa4839d56b9ef2fa2630310836ec2a2;p=dealii.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