diff mbox

opensm: fixed memory leak in osm_console()

Message ID 20110307100302.GJ5577@calypso.voltaire.com (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Alex Netes March 7, 2011, 10:03 a.m. UTC
None
diff mbox

Patch

diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index fad80ad..7003508 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -1279,6 +1279,8 @@  static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 		if (strcmp(p_cmd, "file") == 0) {
 			p_cmd = next_token(p_last);
 			if (p_cmd) {
+				if (output != out)
+					fclose(output);
 				output = fopen(p_cmd, "w+");
 				if (output == NULL) {
 					fprintf(out,