From: Wolfgang Bangerth Date: Sun, 1 Mar 2015 16:20:47 +0000 (-0600) Subject: Ensure we don't create a memory leak. X-Git-Tag: v8.3.0-rc1~401^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4997ea950e836be951c613f474de178e9be88857;p=dealii.git Ensure we don't create a memory leak. --- 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