Close file if fseek failed 347/head
authorsvost <svost@users.noreply.github.com>
Sun, 8 May 2016 20:54:46 +0000 (23:54 +0300)
committersvost <svost@users.noreply.github.com>
Sun, 8 May 2016 20:54:46 +0000 (23:54 +0300)
src/main.cpp

index 48de169..98c2105 100644 (file)
@@ -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))
         {