Author: cwittich
Date: Sat Sep 20 04:05:24 2008
New Revision: 36341
URL:
http://svn.reactos.org/svn/reactos?rev=36341&view=rev
Log:
fix some resource leaks
Modified:
trunk/reactos/base/applications/kbswitch/kbswitch.c
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Sat Sep 20 04:05:24
2008
@@ -34,7 +34,7 @@
HBITMAP hBitmap, hBmpNew, hBmpOld;
RECT rect;
DWORD bkColor, bkText;
- HFONT hFont = NULL;
+ HFONT hFontOld, hFont = NULL;
ICONINFO IconInfo;
HICON hIcon = NULL;
@@ -72,11 +72,12 @@
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FF_DONTCARE, _T("Tahoma"));
- SelectObject(hdc, hFont);
+ hFontOld = SelectObject(hdc, hFont);
DrawText(hdc, _tcsupr(szBuf), 2, &rect,
DT_SINGLELINE|DT_CENTER|DT_VCENTER);
SelectObject(hdc, hBmpNew);
PatBlt(hdc, 0, 0, 16, 16, BLACKNESS);
SelectObject(hdc, hBmpOld);
+ SelectObject(hdc, hFontOld);
IconInfo.hbmColor = hBitmap;
IconInfo.hbmMask = hBmpNew;
@@ -248,6 +249,7 @@
{
_tcscpy(szName, szPath);
RegCloseKey(hKey);
+ FreeLibrary(hLib);
return TRUE;
}
FreeLibrary(hLib);
@@ -285,7 +287,6 @@
_ultot(uLayoutNum, szLayoutNum, 10);
GetLayoutID(szLayoutNum, szLCID);
- CreateTrayIcon(szLCID);
// Switch to the new keyboard layout
GetLocaleInfo((LANGID)_tcstoul(szLCID, NULL, 16), LOCALE_SLANGUAGE,
(LPTSTR)szLangName, sizeof(szLangName) / sizeof(TCHAR));