From 7d8a636c9a234354c9b2ecf01b6e405bece190a1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 11 Oct 2015 03:56:22 -0400 Subject: [PATCH] sim: moxie: fix leakage in error path [BZ #18273] Reported-by: dcb --- sim/moxie/ChangeLog | 5 +++++ sim/moxie/interp.c | 1 + 2 files changed, 6 insertions(+) diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index fe37e82..04b74ce 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,8 @@ +2015-10-11 Mike Frysinger + + PR sim/18273 + * interp.c (load_dtb): Close open file in error path. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index 35ee2a7..df92cee 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1273,6 +1273,7 @@ load_dtb (SIM_DESC sd, const char *filename) if (size != fread (buf, 1, size, f)) { sim_io_eprintf (sd, "ERROR: error reading ``%s''.\n", filename); + fclose (f); return; } sim_core_write_buffer (sd, scpu, write_map, buf, 0xE0000000, size); -- 2.7.4