git: 4594eb454891 - main - systat(1): Plug memory leak
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 08 Feb 2024 06:48:14 UTC
The branch main has been updated by hrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4594eb454891e6247a6ea786f467a0b960ddd835 commit 4594eb454891e6247a6ea786f467a0b960ddd835 Author: Hiroki Sato <hrs@FreeBSD.org> AuthorDate: 2024-02-08 06:45:04 +0000 Commit: Hiroki Sato <hrs@FreeBSD.org> CommitDate: 2024-02-08 06:45:04 +0000 systat(1): Plug memory leak The procstat_getprocs() function call in procgetinfo() allocated a buffer but it was not freed properly. --- usr.bin/systat/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/systat/proc.c b/usr.bin/systat/proc.c index b42d5236927f..25ee286be780 100644 --- a/usr.bin/systat/proc.c +++ b/usr.bin/systat/proc.c @@ -205,7 +205,7 @@ per_proc_swap_usage(struct kinfo_proc *kipp) } while (vmobj != 0); } } - free(freep); + procstat_freevmmap(prstat, freep); return (pages); } @@ -272,6 +272,7 @@ procgetinfo(void) } if (nproc > 1) qsort(pu, nproc, sizeof(*pu), proc_compar); + procstat_freeprocs(prstat, kipp); } void