systat(1): Plug memory leak

The procstat_getprocs() function call in procgetinfo() allocated
a buffer but it was not freed properly.
This commit is contained in:
Hiroki Sato 2024-02-08 15:45:04 +09:00
parent 63007e4611
commit 4594eb4548
No known key found for this signature in database
GPG key ID: DBB07DC66F1F737F

View file

@ -205,7 +205,7 @@ per_proc_swap_usage(struct kinfo_proc *kipp)
} while (vmobj != 0); } while (vmobj != 0);
} }
} }
free(freep); procstat_freevmmap(prstat, freep);
return (pages); return (pages);
} }
@ -272,6 +272,7 @@ procgetinfo(void)
} }
if (nproc > 1) if (nproc > 1)
qsort(pu, nproc, sizeof(*pu), proc_compar); qsort(pu, nproc, sizeof(*pu), proc_compar);
procstat_freeprocs(prstat, kipp);
} }
void void