]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix use of freed memory: Change when to reset the vector
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 24 Jan 2014 16:52:51 +0000 (16:52 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 24 Jan 2014 16:52:51 +0000 (16:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@32300 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/trilinos_vector.h

index 9e7896532b2066bfd985661cb04ae211693c1ee1..951d660755dd7a7d8532e14002cac6ae85fb3130 100644 (file)
@@ -497,15 +497,14 @@ namespace TrilinosWrappers
     void Vector::reinit (const Epetra_Map             &parallel_partitioner,
                          const dealii::Vector<number> &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<size; ++i)
         (*vector)[0][i] = v(gid(parallel_partitioner,i));

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.