From 77e5936c7dcbe3582dae50ef2c03a1e2dfcd5d11 Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Mon, 5 Feb 2024 17:49:18 +0100 Subject: [PATCH] Fix a bug where a file descriptor isn't closed after allocation --- src/emulate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/emulate.c b/src/emulate.c index dd3886ce..b50d0420 100644 --- a/src/emulate.c +++ b/src/emulate.c @@ -1210,4 +1210,7 @@ void dump_registers(riscv_t *rv, char *out_file_path) fprintf(f, " \"x%d\": %u%s\n", i, rv->X[i], comma); } fprintf(f, "}\n"); + + if (out_file_path[0] != '-') + fclose(f); }