In loadConfigFiles, call globfree even if glob fails, since glob can
allocate memory and report partial results on failure. Also
initialize globbuf before calling glob; this is not strictly required,
but hedges against hypothetical libc implementation bugs which could
leave globbuf.gl_pathc or globbuf.gl_pathv uninitialized on error.
ticket: 7981
load_if_changed(MECH_CONF, g_confFileModTime, &highest);
+ memset(&globbuf, 0, sizeof(globbuf));
if (glob(MECH_CONF_PATTERN, 0, NULL, &globbuf) == 0) {
for (path = globbuf.gl_pathv; *path != NULL; path++)
load_if_changed(*path, g_confFileModTime, &highest);
- globfree(&globbuf);
}
+ globfree(&globbuf);
g_confFileModTime = highest;
}