From ac4da722a2e0f75fe047463fe8e1b8be90628a17 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Sun, 5 Mar 2006 14:41:09 +0000 Subject: [PATCH] fix leaks. svn path=/trunk/; revision=21232 --- reactos/dll/cpl/timedate/clock.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reactos/dll/cpl/timedate/clock.c b/reactos/dll/cpl/timedate/clock.c index ddce9ac0b20..ec92265b80e 100644 --- a/reactos/dll/cpl/timedate/clock.c +++ b/reactos/dll/cpl/timedate/clock.c @@ -36,9 +36,12 @@ VOID DrawClock(HDC hdc) { INT iAngle; POINT pt[3]; + HBRUSH hBrush, hBrushOld; + HPEN hPen = NULL, hPenOld = NULL; /* grey brush to fill the dots */ - SelectObject(hdc, CreateSolidBrush(RGB(128, 128, 128))); + hBrush = CreateSolidBrush(RGB(128, 128, 128)); + hBrushOld = SelectObject(hdc, hBrush); for(iAngle = 0; iAngle < 360; iAngle += 6) { @@ -54,7 +57,8 @@ VOID DrawClock(HDC hdc) if (iAngle % 5) { pt[2].x = pt[2].y = 7; - SelectObject(hdc, CreatePen(PS_SOLID, 1, RGB(128, 128, 128))); + hPen = CreatePen(PS_SOLID, 1, RGB(128, 128, 128)); + hPenOld = SelectObject(hdc, hPen); } else @@ -72,6 +76,11 @@ VOID DrawClock(HDC hdc) Ellipse(hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); } + + SelectObject(hdc, hPenOld); + SelectObject(hdc, hBrushOld); + DeleteObject(hBrush); + DeleteObject(hPen); } VOID DrawHands(HDC hdc, SYSTEMTIME * pst, BOOL fChange)