"am_DisconnectComputer()" uses wrong index-variable in loop changes/fix see //!!! void am_DisconnectComputer(LPSTR szComputerName) { int i = 0, j; while (g_stComputers[i].szComputerName != NULL) { if (strcmp(g_stComputers[i].szComputerName, szComputerName) == 0) { break; } ++i; } if (g_stComputers[i].szComputerName != NULL) { free(g_stComputers[i].szComputerName); RegCloseKey(g_stComputers[i].hRegistry); for (j = i; j < MAX_PROVIS_COMPUTERS - 1; j++) { //!!! was: //!!! g_stComputers[i].szComputerName= g_stComputers[i+1].szComputerName; //!!! g_stComputers[i].hRegistry = g_stComputers[i+1].hRegistry; //!!! should read: g_stComputers[j].szComputerName= g_stComputers[j+1].szComputerName; g_stComputers[j].hRegistry = g_stComputers[j+1].hRegistry; } for (i = j; i < MAX_PROVIS_COMPUTERS; i++) { g_stComputers[i].szComputerName = NULL; g_stComputers[i].hRegistry = NULL; } } } 2nd: GetApacheServicesStatus() shouldn't it read: ?! } ++computers; RegCloseKey(hKey); //!!! original position of //!!! RegCloseKey(hKey) causes a handle leak } FindRunningServices(); return TRUE;
Committed and backported for the next 2.0.62 and 2.2.7 releases. Thanks for the patch!