Fix segv in g_covar
authorBerk Hess <hess@kth.se>
Wed, 13 May 2015 10:11:34 +0000 (12:11 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 13 May 2015 11:49:45 +0000 (13:49 +0200)
With fewer trajectory frames than #DOF in the analysis group, g_covar
would print a warning to a NULL pointer instead of stderr.
Fixes #1733.

Change-Id: I546f867d7d95f418212bb5b65005f62de71bdfb8

src/gromacs/gmxana/gmx_covar.c

index f3e575f2288a5cbb9555b707ea9ac1fb8887ddb4..37e9a893cc8b1d4f97f481682669a531f74b223e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -556,9 +556,9 @@ int gmx_covar(int argc, char *argv[])
         if (nframes-1 < ndim)
         {
             end = nframes-1;
-            fprintf(out, "WARNING: there are fewer frames in your trajectory than there are\n");
-            fprintf(out, "degrees of freedom in your system. Only generating the first\n");
-            fprintf(out, "%d out of %d eigenvectors and eigenvalues.\n", end, (int)ndim);
+            fprintf(stderr, "\nWARNING: there are fewer frames in your trajectory than there are\n");
+            fprintf(stderr, "degrees of freedom in your system. Only generating the first\n");
+            fprintf(stderr, "%d out of %d eigenvectors and eigenvalues.\n", end, (int)ndim);
         }
         else
         {