From 1deecd20dfb2896866c7789044f141b388d25aca Mon Sep 17 00:00:00 2001 From: svost Date: Sun, 8 May 2016 23:54:46 +0300 Subject: [PATCH] Close file if fseek failed --- src/main.cpp | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 48de169..98c2105 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2677,7 +2677,10 @@ FILE* AppendBlockFile(unsigned int& nFileRet) if (!file) return NULL; if (fseek(file, 0, SEEK_END) != 0) + { + fclose(file); return NULL; + } // FAT32 file size max 4GB, fseek and ftell max 2GB, so we must stay under 2GB if (ftell(file) < (long)(0x7F000000 - MAX_SIZE)) { -- 1.7.1