windows mod_enum fix potential seg

This commit is contained in:
Jeff Lenk 2011-03-30 21:09:48 -05:00
parent 31580d6661
commit 4e3d1f3f86
1 changed files with 13 additions and 13 deletions

View File

@ -153,14 +153,12 @@ static switch_status_t load_config(void)
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
0, KEY_QUERY_VALUE, &hKey);
if (hKey) {
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz);
if (globals.server) {
free(globals.server);
}
if (data_sz) {
buf = (char*)malloc(data_sz + 1);
RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz);
RegCloseKey(hKey);
if(buf[data_sz - 1] != 0) {
@ -168,6 +166,8 @@ static switch_status_t load_config(void)
}
globals.server = buf;
}
}
}
#endif