[ros-diffs] [gedmurphy] 23556: fix a few resource leaks

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Sat Aug 12 17:17:29 CEST 2006


Author: gedmurphy
Date: Sat Aug 12 19:17:29 2006
New Revision: 23556

URL: http://svn.reactos.org/svn/reactos?rev=23556&view=rev
Log:
fix a few resource leaks

Modified:
    trunk/reactos/base/applications/imagesoft/imagesoft.c

Modified: trunk/reactos/base/applications/imagesoft/imagesoft.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/imagesoft/imagesoft.c?rev=23556&r1=23555&r2=23556&view=diff
==============================================================================
--- trunk/reactos/base/applications/imagesoft/imagesoft.c (original)
+++ trunk/reactos/base/applications/imagesoft/imagesoft.c Sat Aug 12 19:17:29 2006
@@ -29,18 +29,27 @@
     if (!AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) ||
         !AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) )
     {
-        return 1;
+        return Ret;
     }
 
     len = (int)_tcslen(lpAppName) + (int)_tcslen(lpVersion);
     lpTitle = HeapAlloc(ProcessHeap,
                         0,
                         (len + 2) * sizeof(TCHAR));
+    if (lpTitle == NULL)
+    {
+        LocalFree((HLOCAL)lpAppName);
+        LocalFree((HLOCAL)lpVersion);
+        return Ret;
+    }
 
     wsprintf(lpTitle,
              _T("%s %s"),
              lpAppName,
              lpVersion);
+
+    LocalFree((HLOCAL)lpAppName);
+    LocalFree((HLOCAL)lpVersion);
 
     if (TbdInitImpl())
     {
@@ -62,7 +71,6 @@
                         {
                             if (bRet != (BOOL)-1)
                             {
-                                //if (Msg.message == WM_SIZE) MessageBox(NULL, _T("Got it"), NULL, 0);
                                 if (!MainWndTranslateMDISysAccel(hMainWnd,
                                                                  &Msg))
                                 {
@@ -87,7 +95,9 @@
         TbdUninitImpl();
     }
 
-    LocalFree((HLOCAL)lpAppName);
+    HeapFree(GetProcessHeap(), 
+             0, 
+             lpTitle);
 
     return Ret;
 }




More information about the Ros-diffs mailing list