[ros-diffs] [cwittich] 19215: fixed some memory leaks

cwittich at svn.reactos.com cwittich at svn.reactos.com
Mon Nov 14 00:22:09 CET 2005


fixed some memory leaks
Modified: trunk/reactos/subsys/system/msconfig/srvpage.c
  _____  

Modified: trunk/reactos/subsys/system/msconfig/srvpage.c
--- trunk/reactos/subsys/system/msconfig/srvpage.c	2005-11-13
23:05:41 UTC (rev 19214)
+++ trunk/reactos/subsys/system/msconfig/srvpage.c	2005-11-13
23:21:38 UTC (rev 19215)
@@ -156,6 +156,12 @@

                         }
                     }
 
+					if (pServiceFailureActions !=
NULL)
+					{
+
HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
+						pServiceFailureActions =
NULL;
+					}
+
                     /* get vendor of service binary */
                     BytesNeeded = 0;
                     if (!QueryServiceConfig(hService, pServiceConfig,
0, &BytesNeeded))
@@ -188,7 +194,10 @@
                         _tcscpy(FileName,
pServiceConfig->lpBinaryPathName);
                     }
 
-                    dwLen = GetFileVersionInfoSize(FileName,
&dwHandle);
+					HeapFree(GetProcessHeap(), 0,
pServiceConfig);
+					pServiceConfig = NULL;
+
+					dwLen =
GetFileVersionInfoSize(FileName, &dwHandle);
                     if (dwLen)
                     {
                         lpData = (TCHAR*) HeapAlloc(GetProcessHeap(),
0, dwLen);
@@ -212,6 +221,7 @@
                             item.iSubItem = 2;
                             SendMessage(hServicesListCtrl,
LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
                         }  
+
HeapFree(GetProcessHeap(), 0, lpData);
                     }
                     else
                     {
@@ -232,8 +242,6 @@
         }
 
         HeapFree(GetProcessHeap(), 0, pServiceStatus);
-        HeapFree(GetProcessHeap(), 0, pServiceConfig);
-        HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
         CloseServiceHandle(ScHandle);
     }        
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051114/6a71dfd7/attachment.html


More information about the Ros-diffs mailing list