Page MenuHomeFreeBSD

procstat: CID 1593951: Resource leak
ClosedPublic

Authored by dab on Feb 21 2026, 10:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 20, 12:22 AM
Unknown Object (File)
Wed, Apr 8, 12:31 AM
Unknown Object (File)
Tue, Mar 24, 11:22 AM
Unknown Object (File)
Mar 22 2026, 7:51 AM
Unknown Object (File)
Mar 15 2026, 6:16 AM
Unknown Object (File)
Mar 14 2026, 6:18 AM
Unknown Object (File)
Mar 7 2026, 8:08 PM
Unknown Object (File)
Mar 4 2026, 11:03 PM
Subscribers

Details

Summary

A trivial resource leak fix; free the allocated memory before return.

Test Plan

Code inspection, run command.

I built a simple program that waits for a signal on a kqueue, then ran that. The standard procstat displays:

fbsd-dev% Waiting for SIGTERM...
procstat -a kqueue
    PID       KQFD   FILTER      IDENT      FLAGS     FFLAGS       DATA      UDATA     STATUS
  84352          3   SIGNAL         15          C          -          0        0x0          -

The revised procstat displays:

fbsd-dev% sudo LD_LIBRARY_PATH=/usr/obj/usr/home/dab/git/freebsd/src/arm64.aarch64/lib/libutil /usr/obj/usr/home/dab/git/freebsd/src/arm64.aarch64/usr.bin/procstat/procstat -a kqueue
    PID       KQFD   FILTER      IDENT      FLAGS     FFLAGS       DATA      UDATA     STATUS
  84352          3   SIGNAL         15          C          -          0        0x0          -
fbsd-dev%

As expected, the two displays are identical. This doesn't prove that the leak is gone, but it does prove that the revised command still operates correctly. I think it can clearly be seen from inspection of the change that the leak has been remedied.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70860
Build 67743: arc lint + arc unit