Fixed g_cluster logic error
authorMark Abraham <Mark.J.Abraham@gmail.com>
Sat, 26 Mar 2011 04:47:08 +0000 (15:47 +1100)
committerMark Abraham <Mark.J.Abraham@gmail.com>
Sat, 26 Mar 2011 04:47:08 +0000 (15:47 +1100)
g_cluster was attempting to deallocate a gmx_rmpbc_t object when it
might not have been initialized. Since that object is only initialized
under a simple combination of conditions, it makes most sense to clean
up only under those conditions (as well as fix the real reason for the
segfault).

src/tools/gmx_cluster.c

index 171705245661ff78744081191e09908a8ecf8edd..c7652ef6a8f47abf5b90ad1e71931522366ad566 100644 (file)
@@ -1256,9 +1256,10 @@ int gmx_cluster(int argc,char *argv[])
       for(i=0; i<nf; i++)
        reset_x(ifsize,fitidx,isize,NULL,xx[i],mass);
     }
-  }
-  if (bPBC) {
-    gmx_rmpbc_done(gpbc);
+    if (bPBC)
+    {
+      gmx_rmpbc_done(gpbc);
+    }
   }
 
   if (bReadMat) {