]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Solve service status handle leak on multi-service ApacheMonitor
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 22 Dec 2007 20:03:31 +0000 (20:03 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 22 Dec 2007 20:03:31 +0000 (20:03 +0000)
instances, and disconnect computer function on multi-system
applications of ApacheMonitor.

PR: 33803
Reported by: K.W.Schick <drax sawebs.com>
Backport: 606481

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@606482 13f79535-47bb-0310-9956-ffa450edef68

support/win32/ApacheMonitor.c

index 128d9cc2870ebb31ad964732d1badb0818351b8c..fa5a3f8979d8f3346adc17c5cea5f4025d52f243 100644 (file)
@@ -186,15 +186,12 @@ void am_DisconnectComputer(LPSTR szComputerName)
         free(g_stComputers[i].szComputerName);
         RegCloseKey(g_stComputers[i].hRegistry);
         for (j = i; j < MAX_APACHE_COMPUTERS - 1; j++) {
-            g_stComputers[i].szComputerName= g_stComputers[i+1].szComputerName;
-            g_stComputers[i].hRegistry = g_stComputers[i+1].hRegistry;
-        }
-        for (i = j; i < MAX_APACHE_COMPUTERS; i++) {
-            g_stComputers[i].szComputerName = NULL;
-            g_stComputers[i].hRegistry = NULL;
+            g_stComputers[j].szComputerName= g_stComputers[j+1].szComputerName;
+            g_stComputers[j].hRegistry = g_stComputers[j+1].hRegistry;
         }
+        g_stComputers[j].szComputerName = NULL;
+        g_stComputers[j].hRegistry = NULL;
     }
-
 }
 
 
@@ -1048,8 +1045,8 @@ BOOL GetApacheServicesStatus()
             }
         }
         ++computers;
+        RegCloseKey(hKey);
     }
-    RegCloseKey(hKey);
     FindRunningServices();
     return TRUE;
 }