From 84659f6b01bdc37e71a15d017ccc080022a0f5b6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 14 Jan 2020 23:08:13 +0100 Subject: [PATCH] Fixed a resource leak in the hard disk image code. --- src/disk/hdd_image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/disk/hdd_image.c b/src/disk/hdd_image.c index 21fdf00c6..9d5671fae 100644 --- a/src/disk/hdd_image.c +++ b/src/disk/hdd_image.c @@ -128,8 +128,11 @@ image_is_hdx(const wchar_t *s, int check_signature) fseeko64(f, 0, SEEK_END); filelen = ftello64(f); fseeko64(f, 0, SEEK_SET); - if (filelen < 44) + if (filelen < 44) { + if (f != NULL) + fclose(f); return 0; + } fread(&signature, 1, 8, f); fclose(f); if (signature == 0xD778A82044445459ll)