Skip to content

Commit be39662

Browse files
authored
[TASKMGR] Fix a handle leak of ReleaseDC (reactos#8513)
JIRA issue: CORE-20230 Fix a handle leak that forgot ReleaseDC(hParentWnd, hdc); on failure.
1 parent 8e952f1 commit be39662

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

base/applications/taskmgr/graphctl.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,15 @@ GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT
6767
inst->ftPixelsPerPercent = (FLOAT)(inst->BitmapHeight) / 100.00f;
6868

6969
hdc = GetDC(hParentWnd);
70-
hdcg = CreateCompatibleDC(hdc);
71-
inst->hdcGraph = hdcg;
72-
inst->hbmGraph = CreateCompatibleBitmap(hdc, inst->BitmapWidth, inst->BitmapHeight);
73-
74-
if (!hdc ||
75-
!hdcg ||
76-
!inst->hbmGraph)
77-
{
70+
if (!hdc)
7871
goto fail;
79-
}
8072

73+
inst->hdcGraph = hdcg = CreateCompatibleDC(hdc);
74+
inst->hbmGraph = CreateCompatibleBitmap(hdc, inst->BitmapWidth, inst->BitmapHeight);
8175
ReleaseDC(hParentWnd, hdc);
76+
if (!hdcg || !inst->hbmGraph)
77+
goto fail;
78+
8279
hbmOld = (HBITMAP)SelectObject(hdcg, inst->hbmGraph);
8380
DeleteObject(hbmOld);
8481

0 commit comments

Comments
 (0)