Author: cwittich
Date: Sun Apr 19 19:28:03 2015
New Revision: 67305

URL: http://svn.reactos.org/svn/reactos?rev=67305&view=rev
Log:
[RAPPS]
fix handle leaks

Modified:
    trunk/reactos/base/applications/rapps/available.c
    trunk/reactos/base/applications/rapps/installed.c
    trunk/reactos/base/applications/rapps/winmain.c

Modified: trunk/reactos/base/applications/rapps/available.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/available.c?rev=67305&r1=67304&r2=67305&view=diff
==============================================================================
--- trunk/reactos/base/applications/rapps/available.c   [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/available.c   [iso-8859-1] Sun Apr 19 
19:28:03 2015
@@ -26,7 +26,7 @@
         b[0] = '\0';
 
 LIST_ENTRY CachedEntriesHead = { &CachedEntriesHead, &CachedEntriesHead };
-PLIST_ENTRY pCachedEntry = NULL;
+PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
 
 BOOL
 ShowAvailableAppInfo(INT Index)
@@ -150,13 +150,6 @@
     WCHAR szCabPath[MAX_PATH];
     PAPPLICATION_INFO Info;
     HRESULT hr;
-
-    /* initialize the cached list if hasn't been yet */
-    if (pCachedEntry == NULL)
-    {
-        InitializeListHead(&CachedEntriesHead);
-        pCachedEntry = &CachedEntriesHead;
-    }
 
     if (!GetStorageDirectory(szPath, _countof(szPath)))
         return FALSE;

Modified: trunk/reactos/base/applications/rapps/installed.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/installed.c?rev=67305&r1=67304&r2=67305&view=diff
==============================================================================
--- trunk/reactos/base/applications/rapps/installed.c   [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/installed.c   [iso-8859-1] Sun Apr 19 
19:28:03 2015
@@ -282,7 +282,19 @@
                         if (!lpEnumProc(ItemIndex, pszDisplayName, &Info))
                             break;
                     }
+                    else
+                    {
+                        RegCloseKey(Info.hSubKey);
+                    }
                 }
+                else
+                {
+                    RegCloseKey(Info.hSubKey);
+                }
+            }
+            else
+            {
+                RegCloseKey(Info.hSubKey);
             }
         }
 

Modified: trunk/reactos/base/applications/rapps/winmain.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/winmain.c?rev=67305&r1=67304&r2=67305&view=diff
==============================================================================
--- trunk/reactos/base/applications/rapps/winmain.c     [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/winmain.c     [iso-8859-1] Sun Apr 19 
19:28:03 2015
@@ -127,10 +127,17 @@
     INT Index;
 
     if (!SearchPatternMatch(lpName, szSearchPattern))
+    {
+        RegCloseKey(Info->hSubKey);
         return TRUE;
+    }
 
     ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO));
-    if (!ItemInfo) return FALSE;
+    if (!ItemInfo)
+    {
+        RegCloseKey(Info->hSubKey);
+        return FALSE;
+    }
 
     RtlCopyMemory(ItemInfo, Info, sizeof(INSTALLED_INFO));
 


Reply via email to