From 7c8c7f79f60ac1baaed6797c338e8893c2c0aed9 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 17 Sep 2020 15:49:30 -0400 Subject: [PATCH] [ion/simulator] Don't leak file descriptors --- ion/src/simulator/shared/state_file.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ion/src/simulator/shared/state_file.cpp b/ion/src/simulator/shared/state_file.cpp index 124c806fe..57057cfe8 100644 --- a/ion/src/simulator/shared/state_file.cpp +++ b/ion/src/simulator/shared/state_file.cpp @@ -58,7 +58,9 @@ void load(const char * filename) { return; } load(f); - fclose(f); + if (f != stdin) { + fclose(f); + } } static inline bool save(FILE * f) {