From 51b19dfd1ac1777ef129b966b84a6e157fc99db3 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Sun, 25 Feb 2018 14:10:28 +0100
Subject: [PATCH] plug memory leak in fix bond/react

---
 src/USER-MISC/fix_bond_react.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/USER-MISC/fix_bond_react.cpp b/src/USER-MISC/fix_bond_react.cpp
index 6a628f0513..490d491191 100644
--- a/src/USER-MISC/fix_bond_react.cpp
+++ b/src/USER-MISC/fix_bond_react.cpp
@@ -1707,16 +1707,19 @@ void FixBondReact::ghost_glovecast()
 
   global_megasize = 0;
 
-  int *allncols = new int[nprocs]();
+  int *allncols = new int[nprocs];
   for (int i = 0; i < nprocs; i++)
     allncols[i] = 0;
   MPI_Allgather(&ghostly_num_mega, 1, MPI_INT, allncols, 1, MPI_INT, world);
   for (int i = 0; i < nprocs; i++)
     global_megasize = global_megasize + allncols[i];
 
-  if (global_megasize == 0) return;
+  if (global_megasize == 0) {
+    delete [] allncols;
+    return;
+  }
 
-  int *allstarts = new int[nprocs]();
+  int *allstarts = new int[nprocs];
 
   int start = 0;
   for (int i = 0; i < me; i++) {
-- 
GitLab