From e0f89312179085cd8d911d951d493f43ceefe169 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Fri, 24 Jan 2014 16:52:51 +0000 Subject: [PATCH] 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 --- deal.II/include/deal.II/lac/trilinos_vector.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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