A trivial resource leak fix; free the allocated memory before return.
Details
Details
- Reviewers
vangyzen - Commits
- rG42ab99095b7d: procstat: CID 1593951: Resource leak
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
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable