https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a9284b566482e18962209…
commit a9284b566482e18962209c642b0e22aacaf1d2fa
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Apr 9 11:15:51 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Apr 9 11:17:17 2023 +0900
[MSPAINT] Fix handle leaks about memory bitmap
This fixes CORE-18919. CORE-18867
---
base/applications/mspaint/canvas.cpp | 2 +-
base/applications/mspaint/palette.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp
index 3b260b8a5b3..4ce162aa18a 100644
--- a/base/applications/mspaint/canvas.cpp
+++ b/base/applications/mspaint/canvas.cpp
@@ -164,7 +164,7 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT&
rcPaint)
rcPaint.right - rcPaint.left, rcPaint.bottom - rcPaint.top,
hdcMem, rcPaint.left, rcPaint.top, SRCCOPY);
- ::SelectObject(hdcMem, hbmOld);
+ ::DeleteObject(::SelectObject(hdcMem, hbmOld));
::DeleteDC(hdcMem);
}
diff --git a/base/applications/mspaint/palette.cpp
b/base/applications/mspaint/palette.cpp
index 920af27d250..acd5552defc 100644
--- a/base/applications/mspaint/palette.cpp
+++ b/base/applications/mspaint/palette.cpp
@@ -121,7 +121,7 @@ LRESULT CPaletteWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL& b
/* Transfer bits (hDC <-- hMemDC) */
::BitBlt(hDC, 0, 0, rcClient.right, rcClient.bottom, hMemDC, 0, 0, SRCCOPY);
- ::SelectObject(hMemDC, hbmOld);
+ ::DeleteObject(::SelectObject(hMemDC, hbmOld));
::DeleteDC(hMemDC);
EndPaint(&ps);
return 0;