fix a few resource leaks

svn path=/trunk/; revision=23556
This commit is contained in:
Ged Murphy 2006-08-12 15:17:29 +00:00
parent 7c636c8e1f
commit 635b9fb393

View file

@ -29,19 +29,28 @@ WinMain(HINSTANCE hThisInstance,
if (!AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) || if (!AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) ||
!AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) ) !AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) )
{ {
return 1; return Ret;
} }
len = (int)_tcslen(lpAppName) + (int)_tcslen(lpVersion); len = (int)_tcslen(lpAppName) + (int)_tcslen(lpVersion);
lpTitle = HeapAlloc(ProcessHeap, lpTitle = HeapAlloc(ProcessHeap,
0, 0,
(len + 2) * sizeof(TCHAR)); (len + 2) * sizeof(TCHAR));
if (lpTitle == NULL)
{
LocalFree((HLOCAL)lpAppName);
LocalFree((HLOCAL)lpVersion);
return Ret;
}
wsprintf(lpTitle, wsprintf(lpTitle,
_T("%s %s"), _T("%s %s"),
lpAppName, lpAppName,
lpVersion); lpVersion);
LocalFree((HLOCAL)lpAppName);
LocalFree((HLOCAL)lpVersion);
if (TbdInitImpl()) if (TbdInitImpl())
{ {
if (InitMainWindowImpl()) if (InitMainWindowImpl())
@ -62,7 +71,6 @@ WinMain(HINSTANCE hThisInstance,
{ {
if (bRet != (BOOL)-1) if (bRet != (BOOL)-1)
{ {
//if (Msg.message == WM_SIZE) MessageBox(NULL, _T("Got it"), NULL, 0);
if (!MainWndTranslateMDISysAccel(hMainWnd, if (!MainWndTranslateMDISysAccel(hMainWnd,
&Msg)) &Msg))
{ {
@ -87,7 +95,9 @@ WinMain(HINSTANCE hThisInstance,
TbdUninitImpl(); TbdUninitImpl();
} }
LocalFree((HLOCAL)lpAppName); HeapFree(GetProcessHeap(),
0,
lpTitle);
return Ret; return Ret;
} }