mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-21 12:54:42 +02:00
Fix an eventual memory leak
This commit is contained in:
parent
b1e1361189
commit
d4d4163cb3
@ -801,8 +801,6 @@ bool FileManager::reloadBuffer(BufferID id)
|
||||
Document doc = buf->getDocument();
|
||||
Utf8_16_Read UnicodeConvertor;
|
||||
|
||||
char* data = new char[blockSize + 8]; // +8 for incomplete multibyte char
|
||||
|
||||
LoadedFileFormat loadedFileFormat;
|
||||
loadedFileFormat._encoding = buf->getEncoding();
|
||||
loadedFileFormat._eolFormat = EolType::unknown;
|
||||
@ -811,7 +809,6 @@ bool FileManager::reloadBuffer(BufferID id)
|
||||
buf->setLoadedDirty(false); // Since the buffer will be reloaded from the disk, and it will be clean (not dirty), we can set _isLoadedDirty false safetly.
|
||||
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
||||
|
||||
|
||||
//Get file size
|
||||
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
|
||||
if (!fp)
|
||||
@ -819,6 +816,8 @@ bool FileManager::reloadBuffer(BufferID id)
|
||||
_fseeki64(fp, 0, SEEK_END);
|
||||
int64_t fileSize = _ftelli64(fp);
|
||||
fclose(fp);
|
||||
|
||||
char* data = new char[blockSize + 8]; // +8 for incomplete multibyte char
|
||||
|
||||
buf->_canNotify = false; //disable notify during file load, we don't want dirty status to be triggered
|
||||
bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
|
||||
|
Loading…
x
Reference in New Issue
Block a user