plug memory leaks

This commit is contained in:
Axel Kohlmeyer
2025-03-26 04:16:54 -04:00
parent 24389a55dc
commit c95d43f647
7 changed files with 7 additions and 0 deletions

View File

@ -321,6 +321,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// allocate and initialize memory for calculated values and correlators

View File

@ -78,6 +78,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// setup and error check

View File

@ -89,6 +89,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete [] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// setup and error check for both, index arg and values

View File

@ -257,6 +257,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// setup and error check

View File

@ -92,6 +92,7 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// error check

View File

@ -355,6 +355,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// this fix produces a global array

View File

@ -277,6 +277,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS *lmp, int narg, char **arg) :
if (expand) {
for (int i = 0; i < nargnew; i++) delete[] earg[i];
memory->sfree(earg);
memory->sfree(amap);
}
// allocate and initialize memory for averaging