aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-08-12 10:56:32 -0400
committerErik Schnetter <schnetter@gmail.com>2013-08-12 10:56:32 -0400
commitdff327351eb8642931e7d7b328224e29a9133eca (patch)
tree9ae7a11885a594ac6d760582f25cca21f577ea33
parentecb3547afa2f9904e4c4df720413e4685d2b51e2 (diff)
CarpetLib: Correct memory allocation error in communication buffers
-rw-r--r--Carpet/CarpetLib/src/commstate.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/commstate.cc b/Carpet/CarpetLib/src/commstate.cc
index 08b3724db..532461db7 100644
--- a/Carpet/CarpetLib/src/commstate.cc
+++ b/Carpet/CarpetLib/src/commstate.cc
@@ -531,6 +531,11 @@ comm_state::~comm_state ()
{
DECLARE_CCTK_PARAMETERS;
+ // Note: calling resize(0) instead of clear() ensures that the
+ // vector capacity does not change
+ srequests.resize(0);
+ rrequests.resize(0);
+
for (size_t type=0; type<typebufs.size(); ++type) {
typebufdesc& typebuf = typebufs.AT(type);
for (size_t proc=0; proc<typebuf.procbufs.size(); ++proc) {