Bug 33803 - 2 Minor Bugs in Apache Service Monitor
Summary: 2 Minor Bugs in Apache Service Monitor
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: support (show other bugs)
Version: 2.0.53
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2005-03-02 12:50 UTC by K.W.Schick
Modified: 2007-12-22 12:12 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description K.W.Schick 2005-03-02 12:50:42 UTC
"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;
Comment 1 William A. Rowe Jr. 2007-12-22 12:12:01 UTC
Committed and backported for the next 2.0.62 and 2.2.7 releases.

Thanks for the patch!