Fix various memory leaks
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 11 Sep 2016 06:04:03 +0000 (09:04 +0300)
committerErik Lindahl <erik.lindahl@gmail.com>
Mon, 12 Sep 2016 09:20:32 +0000 (11:20 +0200)
commit16e584396c065e4f30b26233c3c7b117617b88f6
tree2ea9d63336a57fbbe11b5eacaf323333d213b9f1
parent8850750d352d51d17789254f0fd730f692c5390e
Fix various memory leaks

These leaks are reported when building and running the tests with
LeakSanitizer (ignoring regression tests and tests marked as integration
tests).

- Free memory on 'gmx help -export completion' paths, which also fixes
  all 'gmx help <module>' paths.
- Free all memory in genconf on exit to make the gmxpreprocess tests not
  leak memory.
- Add settle_free() to free memory properly in mdlib tests.
- Add missing sfree in done_state() (fixes leaks in read_tps_conf() for
  tpr files).
- Add missing virtual destructor in IOptionValueStore (various leaks
  from correct destructors not getting called).
- Free the final symbol in selection parser in case the parsing ends
  after the maximum number of selections has already been provided.
- Add missing frees in selection test helper for atom type strings.

Change-Id: I0d796033ce3b30cda0a18743a28f4d3133fd477f
25 files changed:
src/gromacs/gmxana/gmx_analyze.cpp
src/gromacs/gmxana/gmx_angle.cpp
src/gromacs/gmxana/gmx_chi.cpp
src/gromacs/gmxana/gmx_dipoles.cpp
src/gromacs/gmxana/gmx_dos.cpp
src/gromacs/gmxana/gmx_energy.cpp
src/gromacs/gmxana/gmx_gyrate.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_pme_error.cpp
src/gromacs/gmxana/gmx_rotacf.cpp
src/gromacs/gmxana/gmx_tcaf.cpp
src/gromacs/gmxana/gmx_velacc.cpp
src/gromacs/gmxpreprocess/genconf.cpp
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/mdlib/constr.h
src/gromacs/mdlib/csettle.cpp
src/gromacs/mdlib/tests/settle.cpp
src/gromacs/mdtypes/state.cpp
src/gromacs/options/ivaluestore.h
src/gromacs/selection/parser.cpp
src/gromacs/selection/parser.h
src/gromacs/selection/parser.patch
src/gromacs/selection/parser.y
src/gromacs/selection/tests/toputils.cpp
src/programs/mdrun/mdrun.cpp