Fixed segfault with FE code for older tpr files.
authorSander Pronk <pronk@cbr.su.se>
Thu, 23 Aug 2012 09:16:05 +0000 (11:16 +0200)
committerSander Pronk <pronk@cbr.su.se>
Thu, 23 Aug 2012 09:16:05 +0000 (11:16 +0200)
Full all_lambda array wasn't allocated for gmx 4.5 tpr files, even
though the rest of the code depends on it.

Change-Id: I3e4b6273d9e769a430fffc95e3a9c94fb672f6f3

src/gmxlib/tpxio.c

index 68bcadbc28e6aab97dd1c98051bb3719e395e0c7..29bf75167a63d98bb80b74f72042931aeb458e43 100644 (file)
@@ -375,6 +375,16 @@ static void do_fepvals(t_fileio *fio,t_lambda *fepvals,gmx_bool bRead, int file_
       {
           fepvals->separate_dvdl[efptFEP] = TRUE;
       }
+      /* still allocate the all_lambda array's contents. */
+      for (g=0;g<efptNR;g++)
+      {
+          if (fepvals->n_lambda > 0) {
+              if (bRead)
+              {
+                  snew(fepvals->all_lambda[g],fepvals->n_lambda);
+              }
+          }
+      }
   }
   else
   {