FlushBlockFile(): check for valid FILE pointer
- don't call FileCommit() and fclose() if no valid FILE pointer was returned by OpenBlockFile()
This commit is contained in:
parent
cd7fb7d1de
commit
b19388dd88
1 changed files with 8 additions and 4 deletions
12
src/main.cpp
12
src/main.cpp
|
@ -1540,12 +1540,16 @@ void static FlushBlockFile()
|
|||
posOld.nPos = 0;
|
||||
|
||||
FILE *fileOld = OpenBlockFile(posOld);
|
||||
FileCommit(fileOld);
|
||||
fclose(fileOld);
|
||||
if (fileOld) {
|
||||
FileCommit(fileOld);
|
||||
fclose(fileOld);
|
||||
}
|
||||
|
||||
fileOld = OpenUndoFile(posOld);
|
||||
FileCommit(fileOld);
|
||||
fclose(fileOld);
|
||||
if (fileOld) {
|
||||
FileCommit(fileOld);
|
||||
fclose(fileOld);
|
||||
}
|
||||
}
|
||||
|
||||
bool FindUndoPos(int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
|
||||
|
|
Loading…
Reference in a new issue