From c0b38ec7504d6a04b2f9ff003382818404a122f5 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 1 Mar 2015 13:07:37 -0600 Subject: [PATCH] Fix another occurrence of allocate() in the serialization load function. This also uncovers a memory leak we had. --- include/deal.II/lac/vector.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 1a08867d98..a44067ba2e 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -1347,12 +1347,14 @@ inline void Vector::load (Archive &ar, const unsigned int) { - // forward to serialization function in the base class. - ar &static_cast(*this); + // get rid of previous content + deallocate(); + // the load stuff again from the archive + ar &static_cast(*this); ar &vec_size &max_vec_size ; - allocate(max_vec_size); + allocate(); ar &boost::serialization::make_array(val, max_vec_size); } -- 2.39.5