diff --git a/PowerEditor/src/MISC/md5/md5Dlgs.cpp b/PowerEditor/src/MISC/md5/md5Dlgs.cpp index 3b9da081f..85c326a48 100644 --- a/PowerEditor/src/MISC/md5/md5Dlgs.cpp +++ b/PowerEditor/src/MISC/md5/md5Dlgs.cpp @@ -360,6 +360,7 @@ void HashFromTextDlg::generateHash() break; default: + delete[] text; return; } @@ -444,6 +445,7 @@ void HashFromTextDlg::generateHashPerLine() break; default: + delete[] text; return; } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 875678fa0..9c3a1464f 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -471,6 +471,8 @@ void Notepad_plus::command(int id) ::GlobalUnlock(hglbCopy); + pBinText.reset(nullptr); // free possible big membuf ASAP + // Place the handle on the clipboard. if (!::SetClipboardData(CF_TEXT, hglbCopy)) { @@ -3477,6 +3479,7 @@ void Notepad_plus::command(int id) break; default: + delete[] selectedStr; return; } for (int i = 0; i < hashLen; i++) diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 2122b0312..d2866439e 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -3061,6 +3061,7 @@ bool FindReplaceDlg::processFindNext(const wchar_t *txt2find, const FindOption * else if (posFind == FIND_INVALID_REGULAR_EXPRESSION) { // error setStatusbarMessageWithRegExprErr(*_ppEditView); + delete[] pText; return false; } @@ -3655,8 +3656,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl default: { - delete [] pTextFind; - delete [] pTextReplace; + delete[] pTextFind; + if (pTextReplace) + delete[] pTextReplace; return nbProcessed; } @@ -3672,8 +3674,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl findReplaceInfo._endRange += replaceDelta; //adjust end of range in case of replace } - delete [] pTextFind; - delete [] pTextReplace; + delete[] pTextFind; + if (pTextReplace) + delete[] pTextReplace; if (nbProcessed > 0) { diff --git a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp index 1f803e9e1..81d0320c6 100644 --- a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp +++ b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp @@ -295,7 +295,8 @@ intptr_t CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam catch (...) { MessageBox(_hSelf, L"Cannot process this clipboard data in the history:\nThe data is too large to be treated.", L"Clipboard problem", MB_OK | MB_APPLMODAL); - delete[] c; + if (c) + delete[] c; } } }