Fix uninitialized fields in grompp t_state
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 11 May 2015 19:48:00 +0000 (21:48 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 12 May 2015 13:31:23 +0000 (15:31 +0200)
commit9fbe7e5b70cf3a6030daa64e64a7d2f156be653e
treeadd760f85891e8a40e51d8d7d1da14e557d12351
parent262bf922dec01ec0e0e284d656189cec476e4f33
Fix uninitialized fields in grompp t_state

Allocating t_state on the stack and using an incomplete
pseudo-constructor means it is possible to write an uninitialized
value in fep_state field to the .tpr file, which we've been
doing. Found with Memory Sanitizer. Perhaps this behaviour lies behind
some of the strange behaviour that is periodically seen on Jenkins.

Fixed by allocating t_state on the heap, which might resolve other
issues, since snew() zeroes the memory as a side effect. Also
initialized fep_state field in init_state().

Refs #1729, #1730

Change-Id: Ibcee7bff1e090fb1991969c4562f44f056868a03
src/gromacs/gmxlib/typedefs.c
src/gromacs/gmxpreprocess/grompp.c