From 03a304f211ccf53578f894083e72fc0aa328f9c2 Mon Sep 17 00:00:00 2001
From: erg <devnull@localhost>
Date: Mon, 16 Nov 2009 21:02:21 +0000
Subject: [PATCH] Fixes for bug 1816

---
 lib/neatogen/stress.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/neatogen/stress.c b/lib/neatogen/stress.c
index 1e3988912..41710da63 100644
--- a/lib/neatogen/stress.c
+++ b/lib/neatogen/stress.c
@@ -1551,6 +1551,9 @@ int stress_majorization_kD_mkernel(vtx_data * graph,	/* Input graph in sparse re
 #ifdef ALTERNATIVE_STRESS_CALC
     double mat_stress;
 #endif
+#ifdef NONCORE
+    FILE* fp = NULL;
+#endif
 
 	/*************************************************
 	** Computation of full, dense, unrestricted k-D ** 
@@ -1704,6 +1707,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph,	/* Input graph in sparse re
 	fp = fopen(FILENAME, "wb");
 	fwrite(lap2, sizeof(float), lap_length, fp);
 	fclose(fp);
+	fp = NULL;
     }
 #endif
 
@@ -1884,6 +1888,11 @@ int stress_majorization_kD_mkernel(vtx_data * graph,	/* Input graph in sparse re
 #endif /* WITH_CGRAPH */
 	}
     }
+#ifdef NONCORE
+    if (fp)
+	fclose (fp);
+#endif
+
     free(coords[0]);
     free(coords);
 
-- 
2.40.0