mirror of
https://github.com/reactos/reactos.git
synced 2026-06-02 01:11:03 +08:00
[TASKMGR] Fix a handle leak of ReleaseDC (#8513)
JIRA issue: CORE-20230 Fix a handle leak that forgot ReleaseDC(hParentWnd, hdc); on failure.
This commit is contained in:
@@ -67,18 +67,15 @@ GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT
|
||||
inst->ftPixelsPerPercent = (FLOAT)(inst->BitmapHeight) / 100.00f;
|
||||
|
||||
hdc = GetDC(hParentWnd);
|
||||
hdcg = CreateCompatibleDC(hdc);
|
||||
inst->hdcGraph = hdcg;
|
||||
inst->hbmGraph = CreateCompatibleBitmap(hdc, inst->BitmapWidth, inst->BitmapHeight);
|
||||
|
||||
if (!hdc ||
|
||||
!hdcg ||
|
||||
!inst->hbmGraph)
|
||||
{
|
||||
if (!hdc)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
inst->hdcGraph = hdcg = CreateCompatibleDC(hdc);
|
||||
inst->hbmGraph = CreateCompatibleBitmap(hdc, inst->BitmapWidth, inst->BitmapHeight);
|
||||
ReleaseDC(hParentWnd, hdc);
|
||||
if (!hdcg || !inst->hbmGraph)
|
||||
goto fail;
|
||||
|
||||
hbmOld = (HBITMAP)SelectObject(hdcg, inst->hbmGraph);
|
||||
DeleteObject(hbmOld);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user