Author: cwittich
Date: Sat Sep 20 09:13:10 2008
New Revision: 36352
URL:
http://svn.reactos.org/svn/reactos?rev=36352&view=rev
Log:
-fix resource leaks
-don't free memory allocated by LocalAlloc with HeapFree
Modified:
trunk/rosapps/applications/devutils/genguid/genguid.c
trunk/rosapps/applications/devutils/vgafontedit/fontboxeswnd.c
trunk/rosapps/applications/devutils/vgafontedit/fontwnd.c
trunk/rosapps/applications/devutils/vgafontedit/mainwnd.c
Modified: trunk/rosapps/applications/devutils/genguid/genguid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/geng…
==============================================================================
--- trunk/rosapps/applications/devutils/genguid/genguid.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/devutils/genguid/genguid.c [iso-8859-1] Sat Sep 20 09:13:10
2008
@@ -23,8 +23,7 @@
int main(int argc, char *argv[])
{
- GUID m_guid;
- m_guid = GUID_NULL;
+ GUID m_guid = GUID_NULL;
int arg;
HRESULT result;
char *strfmt = "";
Modified: trunk/rosapps/applications/devutils/vgafontedit/fontboxeswnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/vgaf…
==============================================================================
--- trunk/rosapps/applications/devutils/vgafontedit/fontboxeswnd.c [iso-8859-1]
(original)
+++ trunk/rosapps/applications/devutils/vgafontedit/fontboxeswnd.c [iso-8859-1] Sat Sep 20
09:13:10 2008
@@ -108,10 +108,11 @@
UCHAR uCharacterRow;
UCHAR uBit;
WCHAR szInfoText[9];
+ HBITMAP hBitmapOld;
// Preparations
hBoxDC = CreateCompatibleDC(NULL);
- SelectObject(hBoxDC, Info->MainWndInfo->hBoxBmp);
+ hBitmapOld = SelectObject(hBoxDC, Info->MainWndInfo->hBoxBmp);
hFont = CreateFontW(13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Tahoma");
hOldFont = SelectObject(ps->hdc, hFont);
@@ -177,6 +178,7 @@
}
}
+ SelectObject(hBoxDC, hBitmapOld);
SelectObject(ps->hdc, hOldFont);
DeleteObject(hFont);
SelectObject(ps->hdc, hOldBrush);
Modified: trunk/rosapps/applications/devutils/vgafontedit/fontwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/vgaf…
==============================================================================
--- trunk/rosapps/applications/devutils/vgafontedit/fontwnd.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/devutils/vgafontedit/fontwnd.c [iso-8859-1] Sat Sep 20
09:13:10 2008
@@ -146,7 +146,7 @@
LoadAndFormatString(IDS_SAVEPROMPT, &pszPrompt, szFile);
nMsgBoxResult = MessageBoxW(hwnd, pszPrompt, szAppName,
MB_YESNOCANCEL | MB_ICONQUESTION);
- HeapFree(hProcessHeap, 0, pszPrompt);
+ LocalFree(pszPrompt);
switch(nMsgBoxResult)
{
@@ -394,7 +394,7 @@
(LPARAM)Info );
if(!OpenInfo->pszFileName)
- HeapFree(hProcessHeap, 0, pszWindowTitle);
+ LocalFree(pszWindowTitle);
if(hFontWnd)
{
Modified: trunk/rosapps/applications/devutils/vgafontedit/mainwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/devutils/vgaf…
==============================================================================
--- trunk/rosapps/applications/devutils/vgafontedit/mainwnd.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/devutils/vgafontedit/mainwnd.c [iso-8859-1] Sat Sep 20
09:13:10 2008
@@ -15,15 +15,16 @@
{
HDC hMemDC;
HDC hMainDC;
- HPEN hPen;
+ HPEN hPen, hPenOld;
RECT rect;
+ HBITMAP hBitmapOld;
hMemDC = CreateCompatibleDC(NULL);
hMainDC = GetDC(Info->hMainWnd);
// Create the "Box" bitmap
Info->hBoxBmp = CreateCompatibleBitmap(hMainDC, CHARACTER_BOX_WIDTH,
CHARACTER_BOX_HEIGHT);
- SelectObject(hMemDC, Info->hBoxBmp);
+ hBitmapOld = SelectObject(hMemDC, Info->hBoxBmp);
rect.left = 0;
rect.top = 0;
@@ -31,20 +32,24 @@
rect.bottom = CHARACTER_INFO_BOX_HEIGHT;
FillRect( hMemDC, &rect, (HBRUSH)(COLOR_BTNFACE + 1) );
- SelectObject( hMemDC, GetStockObject(WHITE_PEN) );
+ hPenOld = SelectObject( hMemDC, GetStockObject(WHITE_PEN) );
Rectangle(hMemDC, 0, 0, CHARACTER_INFO_BOX_WIDTH - 1, 2);
Rectangle(hMemDC, 0, 2, 2, CHARACTER_INFO_BOX_HEIGHT - 1);
+ hPen = SelectObject(hMemDC, hPenOld);
hPen = CreatePen( PS_SOLID, 1, RGB(128, 128, 128) );
- SelectObject(hMemDC, hPen);
+ hPenOld = SelectObject(hMemDC, hPen);
Rectangle(hMemDC, 1, CHARACTER_INFO_BOX_HEIGHT - 2, CHARACTER_INFO_BOX_WIDTH,
CHARACTER_INFO_BOX_HEIGHT);
Rectangle(hMemDC, CHARACTER_INFO_BOX_WIDTH - 2, 1, CHARACTER_INFO_BOX_WIDTH,
CHARACTER_INFO_BOX_HEIGHT - 2);
SetPixel( hMemDC, CHARACTER_INFO_BOX_WIDTH - 1, 0, RGB(128, 128, 128) );
SetPixel( hMemDC, 0, CHARACTER_INFO_BOX_HEIGHT - 1, RGB(128, 128, 128) );
-
+ SelectObject(hMemDC, hBitmapOld);
+
+ hPen = SelectObject(hMemDC, hPenOld);
DeleteObject(hPen);
DeleteDC(hMemDC);
+ ReleaseDC(Info->hMainWnd, hMainDC);
}
static VOID