Commit 7a90eef5 authored by Steve Plimpton's avatar Steve Plimpton Committed by GitHub
Browse files

Merge pull request #668 from ovilab/modify_deallocation_fix

Fixed proper deletion of fixes if fix is NULL
parents 5d0626e5 23e283f1
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ Modify::~Modify()
  // delete all fixes
  // do it via delete_fix() so callbacks in Atom are also updated correctly

  while (nfix) delete_fix(fix[0]->id);
  while (nfix) delete_fix(0);
  memory->sfree(fix);
  memory->destroy(fmask);

@@ -944,6 +944,12 @@ void Modify::delete_fix(const char *id)
{
  int ifix = find_fix(id);
  if (ifix < 0) error->all(FLERR,"Could not find fix ID to delete");
  delete_fix(ifix);
}

void Modify::delete_fix(int ifix)
{
  if(fix[ifix])
    delete fix[ifix];
  atom->update_callback(ifix);

+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ class Modify : protected Pointers {
  void add_fix(int, char **, int trysuffix=1);
  void modify_fix(int, char **);
  void delete_fix(const char *);
  void delete_fix(int);
  int find_fix(const char *);
  int find_fix_by_style(const char *);
  int check_package(const char *);