fix memory leak in pair style sw/intel for good

This commit is contained in:
Axel Kohlmeyer
2020-07-08 22:04:55 -04:00
parent 909bc5a801
commit bebd10712a
2 changed files with 6 additions and 11 deletions

View File

@ -1286,17 +1286,12 @@ void PairSWIntel::ForceConst<flt_t>::set_ntypes(const int ntypes,
}
#endif
_memory->destroy(op2);
_memory->destroy(op2f);
_memory->destroy(op2f2);
_memory->destroy(op2e);
_memory->destroy(op3);
memory->destroy(p2);
memory->destroy(p2f);
memory->destroy(p2f2);
memory->destroy(p2e);
memory->destroy(p3);
}
memory->destroy(p2);
memory->destroy(p2f);
memory->destroy(p2f2);
memory->destroy(p2e);
memory->destroy(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), p2(0), p2f(0), p2f2(0), p2e(0), p3(0) {}
ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {}
~ForceConst() { set_ntypes(0, NULL, _cop); }
void set_ntypes(const int ntypes, Memory *memory, const int cop);