avoid memory leak in pair style sw/intel

This commit is contained in:
Axel Kohlmeyer
2020-07-08 20:11:17 -04:00
parent 240c33b503
commit 7071cff481
2 changed files with 6 additions and 1 deletions

View File

@ -1292,6 +1292,11 @@ void PairSWIntel::ForceConst<flt_t>::set_ntypes(const int ntypes,
_memory->destroy(op2e);
_memory->destroy(op3);
}
memory->destroy(p2);
memory->create(p2f);
memory->create(p2f2);
memory->create(p2e);
memory->create(p3);
if (ntypes > 0) {
_cop = cop;
memory->create(p2,ntypes,ntypes,"fc.p2");

View File

@ -87,7 +87,7 @@ class PairSWIntel : public PairSW {
fc_packed2 **p2e;
fc_packed3 ***p3;
ForceConst() : _ntypes(0) {}
ForceConst() : _ntypes(0), p2(0), p2f(0), p2f2(0), p2e(0), p3(0) {}
~ForceConst() { set_ntypes(0, NULL, _cop); }
void set_ntypes(const int ntypes, Memory *memory, const int cop);