]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix another occurrence of allocate() in the serialization load function. 624/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 1 Mar 2015 19:07:37 +0000 (13:07 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 1 Mar 2015 19:08:07 +0000 (13:08 -0600)
This also uncovers a memory leak we had.

include/deal.II/lac/vector.h

index 1a08867d98627dcd4d0e717b86986a790e0ef56a..a44067ba2eae97ea3f6b9c326b0aa46c2801a2a9 100644 (file)
@@ -1347,12 +1347,14 @@ inline
 void
 Vector<Number>::load (Archive &ar, const unsigned int)
 {
-  // forward to serialization function in the base class.
-  ar   &static_cast<Subscriptor &>(*this);
+  // get rid of previous content
+  deallocate();
 
+  // the load stuff again from the archive
+  ar &static_cast<Subscriptor &>(*this);
   ar &vec_size &max_vec_size ;
 
-  allocate(max_vec_size);
+  allocate();
   ar &boost::serialization::make_array(val, max_vec_size);
 }
 

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.