From: Kevin Boyd Date: Sun, 16 Dec 2018 00:25:19 +0000 (-0500) Subject: Fix memory leak at end of do_md X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=0926c8a6abe500178cb9d816278add1677e545cc;p=alexxy%2Fgromacs.git Fix memory leak at end of do_md Without domain decomposition, the atomtypes field of localtop is dynamically allocated and needs freeing after mdrun Refs #2693 Change-Id: I45d18c503a87832332868e7fb9b63720548f243c --- diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index 021ca12b68..68d166d24b 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -1536,6 +1536,13 @@ void gmx::Integrator::do_md() walltime_accounting_set_nsteps_done(walltime_accounting, step_rel); destroy_enerdata(enerd); + sfree(enerd); + + /* Clean up topology. top->atomtypes has an allocated pointer if no domain decomposition*/ + if (!DOMAINDECOMP(cr)) + { + done_atomtypes(&top->atomtypes); + } sfree(top); }