fix bug sigar_get_kstats_multi where not enough memory was allocated

This commit is contained in:
Doug MacEachern 2004-12-17 00:43:32 +00:00
parent eb1528f3f4
commit 55e669634c

View File

@ -20,7 +20,7 @@ int sigar_get_multi_kstats(sigar_t *sigar,
while ((ksp = kstat_lookup(kc, kl->name, i, NULL))) { while ((ksp = kstat_lookup(kc, kl->name, i, NULL))) {
if (i+1 > kl->num) { if (i+1 > kl->num) {
kl->num = i+1; kl->num = i+1;
kl->ks = realloc(kl->ks, kl->num); kl->ks = realloc(kl->ks, kl->num * sizeof(*kl->ks));
} }
kl->ks[i] = ksp; kl->ks[i] = ksp;
i++; i++;