From 4997ea950e836be951c613f474de178e9be88857 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 1 Mar 2015 10:20:47 -0600 Subject: [PATCH] Ensure we don't create a memory leak. --- include/deal.II/lac/vector.templates.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index 40e416589a..9aa6f0d261 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -2045,6 +2045,8 @@ template void Vector::allocate() { + // make sure that we don't create a memory leak + Assert (val == 0, ExcInternalError()); val = static_cast(_mm_malloc (sizeof(Number)*max_vec_size, 64)); Assert (val != 0, ExcOutOfMemory()); } @@ -2056,6 +2058,7 @@ void Vector::deallocate() { _mm_free(val); + val = 0; } DEAL_II_NAMESPACE_CLOSE -- 2.39.5