Unverified Commit b49f0a6a authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid memory leak in pair style sw/intel

parent 4b2c1f5e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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");
+1 −1
Original line number Diff line number Diff line
@@ -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);