HomeFreeBSD

systat: Avoid incorrect reallocation in pigs.c

Description

systat: Avoid incorrect reallocation in pigs.c

Stop free() even if kvm_getprocs as we can come back but set nprocs = 0.
Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed.
Current code can have pt with non-null after kvm_getprocs() failure.

Replace to realloc for simpler operations.

Submitted by: Yoshihiro Ota ota@j.email.ne.jp
Reviewed by: mckusick@
Differential Revision: https://reviews.freebsd.org/D29303

Details

Provenance
mrAuthored on Apr 21 2021, 6:09 PM
Differential Revision
D29303: systat: Avoid incorrect reallocation in pigs.c
Parents
rG9c651561a2a3: zfs: damage control racing .. lookups in face of mkdir/rmdir
Branches
Unknown
Tags
Unknown